{"id":19365,"library":"babel-tape-runner","title":"babel-tape-runner","description":"A test runner that combines Babel and Tape to transpile and execute test suites containing ESNext/Harmony features. Current stable version is 3.0.0, supporting Babel 7. It serves as a drop-in replacement for Tape's bundled runner, reading Babel configuration from .babelrc. The package follows a semver-aligned versioning scheme with major versions tied to Babel major releases (v1 for Babel 5, v2 for Babel 6, v3 for Babel 7). Key differentiator is the seamless integration of Babel transpilation with Tape's simple test framework, enabling modern JavaScript syntax in tests without manual setup.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/wavded/babel-tape-runner","tags":["javascript","babel","tape","tests","testing","harmony","es6","esnext"],"install":[{"cmd":"npm install babel-tape-runner","lang":"bash","label":"npm"},{"cmd":"yarn add babel-tape-runner","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-tape-runner","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for transpilation in Babel 7 (v3.x).","package":"@babel/core","optional":false},{"reason":"Peer dependency; babel-tape-runner uses tape as the test framework.","package":"tape","optional":false}],"imports":[{"note":"babel-tape-runner is a CLI tool, not a module. Use it directly from command line or via npm scripts. It does not export JavaScript symbols.","wrong":"import { babelTapeRunner } from 'babel-tape-runner'","symbol":"babel-tape-runner","correct":"npx babel-tape-runner my-test.js"},{"note":"tape is a separate package; babel-tape-runner does not re-export test. Use 'import test from 'tape'' in your test files.","wrong":"const test = require('babel-tape-runner').test;","symbol":"test (tape)","correct":"import test from 'tape';"},{"note":"babel-tape-runner transpiles your test files using Babel, so you can use ESM imports/exports in your tests. However, .babelrc must be configured accordingly.","wrong":"const foo = require('./bar'); // This won't be transpiled for ESM syntax","symbol":"ESNext features","correct":"import { foo } from './bar'; // ESM import, transpiled by babel-tape-runner"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev tape babel-tape-runner @babel/core @babel/preset-env\n\n// Create .babelrc\n{\n  \"presets\": [\"@babel/preset-env\"]\n}\n\n// Create test file: test.js\nimport test from 'tape';\n\ntest('basic math', (t) => {\n  const sum = (a, b) => a + b;\n  t.equal(sum(1, 2), 3, '1 + 2 = 3');\n  t.end();\n});\n\n// Run tests\nnpx babel-tape-runner test.js\n\n// Output: TAP version 13\n// # basic math\n// ok 1 1 + 2 = 3\n//\n// 1..1\n// # tests 1\n// # pass  1\n// # ok","lang":"javascript","description":"Demonstrates setting up babel-tape-runner with Babel 7 and tape, including installation, .babelrc configuration, writing a test with ESNext arrow functions, and running it."},"warnings":[{"fix":"Ensure babel-tape-runner version matches your Babel version. Update .babelrc and Babel presets accordingly.","message":"Babel 7: Use babel-tape-runner ^3.0.0. Babel 6: Use babel-tape-runner ^2.0.0. Babel 5: Use babel-tape-runner ^1.0.0. Breaking changes between major versions due to Babel API changes.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use babel-tape-runner only from command line or npm scripts. Use tape directly for test API.","message":"babel-tape-runner is a CLI tool and does not export any JavaScript functions. Do not attempt to import or require it in your code.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider migrating to modern alternatives like '@babel/register' with tape or use a test framework with built-in transpilation (e.g., jest, mocha with @babel/register).","message":"The package has not been updated since September 2019. It may not support Babel 8 or newer tape versions.","severity":"deprecated","affected_versions":"3.0.0"},{"fix":"Always quote glob patterns in npm scripts: \"test\": \"babel-tape-runner \\\"lib/**/__tests__/*-test.js\\\"\"","message":"Glob patterns for test files may need quoting in package.json scripts to avoid shell expansion issues.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev @babel/preset-env' and ensure .babelrc contains '{\"presets\": [\"@babel/preset-env\"]}'.","cause":"Babel presets not installed or .babelrc misconfigured.","error":"Error: Couldn't find preset \"@babel/preset-env\" relative to directory ..."},{"fix":"Install and configure @babel/preset-env in .babelrc and use babel-tape-runner v3 (for Babel 7).","cause":"Using ESM imports without proper Babel preset, or using too old Babel version.","error":"SyntaxError: Unexpected token import"},{"fix":"Install globally with 'npm install -g babel-tape-runner' or use npx: 'npx babel-tape-runner test.js'. Alternatively, add to package.json scripts.","cause":"babel-tape-runner not installed or not in PATH.","error":"babel-tape-runner is not recognized as an internal or external command"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}