Registry / testing / babel-tape-runner

babel-tape-runner

JSON →
library3.0.0jsnpmunverified

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.

npm install babel-tape-runner
INSTALL
IMPORT
SIG · BABEL-TAPE-RUNNER
B
babel-tape-runner
testingjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

babel-tape-runner
npx babel-tape-runner my-test.js
import { babelTapeRunner } from 'babel-tape-runner'
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.
test (tape)
import test from 'tape';
const test = require('babel-tape-runner').test;
tape is a separate package; babel-tape-runner does not re-export test. Use 'import test from 'tape'' in your test files.
ESNext features
import { foo } from './bar'; // ESM import, transpiled by babel-tape-runner
const foo = require('./bar'); // This won't be transpiled for ESM syntax
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.

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.

// Install dependencies npm install --save-dev tape babel-tape-runner @babel/core @babel/preset-env // Create .babelrc { "presets": ["@babel/preset-env"] } // Create test file: test.js import test from 'tape'; test('basic math', (t) => { const sum = (a, b) => a + b; t.equal(sum(1, 2), 3, '1 + 2 = 3'); t.end(); }); // Run tests npx babel-tape-runner test.js // Output: TAP version 13 // # basic math // ok 1 1 + 2 = 3 // // 1..1 // # tests 1 // # pass 1 // # ok
babel-tape-runner --version
Debug
Known issues
breakingBabel 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.
fix
Ensure babel-tape-runner version matches your Babel version. Update .babelrc and Babel presets accordingly.
affects: >=1.0.0
gotchababel-tape-runner is a CLI tool and does not export any JavaScript functions. Do not attempt to import or require it in your code.
fix
Use babel-tape-runner only from command line or npm scripts. Use tape directly for test API.
affects: all
deprecatedThe package has not been updated since September 2019. It may not support Babel 8 or newer tape versions.
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).
affects: 3.0.0
gotchaGlob patterns for test files may need quoting in package.json scripts to avoid shell expansion issues.
fix
Always quote glob patterns in npm scripts: "test": "babel-tape-runner \"lib/**/__tests__/*-test.js\""
affects: all
Errors
Common errors & fixes
Error: Couldn't find preset "@babel/preset-env" relative to directory ...
Babel presets not installed or .babelrc misconfigured.
fix
Run 'npm install --save-dev @babel/preset-env' and ensure .babelrc contains '{"presets": ["@babel/preset-env"]}'.
SyntaxError: Unexpected token import
Using ESM imports without proper Babel preset, or using too old Babel version.
fix
Install and configure @babel/preset-env in .babelrc and use babel-tape-runner v3 (for Babel 7).
babel-tape-runner is not recognized as an internal or external command
babel-tape-runner not installed or not in PATH.
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.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
@babel/corerequiredRequired for transpilation in Babel 7 (v3.x).
taperequiredPeer dependency; babel-tape-runner uses tape as the test framework.
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
babel-tape-runner — npm install babel-tape-runner · libregistry