{"id":18146,"library":"babel-helper-plugin-test-runner","title":"babel-helper-plugin-test-runner","description":"Internal Babel helper for running plugin tests. Version 6.24.1 is an older release from Babel 6 era. This package is part of Babel's monorepo and is not intended for direct external use. It provides a test runner helper for Babel plugins. The current stable major version is 7.x (e.g., 7.29.2) with Babel 8 (8.0.0-rc.3) in release candidate. Key differentiator: purely internal to Babel, not designed for public consumption, may have breaking changes across major versions. Use @babel/helper-plugin-test-runner for Babel 7+.","status":"active","version":"6.24.1","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner","tags":["javascript"],"install":[{"cmd":"npm install babel-helper-plugin-test-runner","lang":"bash","label":"npm"},{"cmd":"yarn add babel-helper-plugin-test-runner","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-helper-plugin-test-runner","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Babel transformations in tests","package":"@babel/core","optional":false}],"imports":[{"note":"CommonJS require works for v6 but discouraged; Babel 7+ uses @babel/helper-plugin-test-runner","wrong":"const testRunner = require('babel-helper-plugin-test-runner')","symbol":"default","correct":"import testRunner from 'babel-helper-plugin-test-runner'"},{"note":"For Babel 7+, package renamed to @babel/helper-plugin-test-runner","wrong":"const testRunner = require('@babel/helper-plugin-test-runner')","symbol":"default","correct":"import testRunner from '@babel/helper-plugin-test-runner'"},{"note":"CJS is still valid for Babel 7+ but ESM preferred","wrong":"","symbol":"default","correct":"const testRunner = require('@babel/helper-plugin-test-runner')"}],"quickstart":{"code":"import pluginTester from 'babel-helper-plugin-test-runner';\nimport myPlugin from './my-plugin';\n\nconst runTest = pluginTester(myPlugin);\nconst result = runTest({\n  code: 'const x = 1;',\n  snapshot: true\n});\nconsole.log(result);","lang":"javascript","description":"Example of using babel-helper-plugin-test-runner to test a Babel plugin with a code fixture."},"warnings":[{"fix":"Update to @babel/helper-plugin-test-runner for Babel 7+","message":"Renamed from babel-helper-plugin-test-runner to @babel/helper-plugin-test-runner in Babel 7. Old package may not receive updates.","severity":"breaking","affected_versions":"<7.0.0"},{"fix":"Consider using @babel/core's built-in test utilities or a dedicated test framework like Jest with babel-jest.","message":"The package is internal to Babel and may break without notice across minor versions.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Use import statement or upgrade to Babel 7+ with @babel/helper-plugin-test-runner","message":"CommonJS require() works in v6 but is not the recommended import style; prefer ESM for consistency with modern Babel.","severity":"gotcha","affected_versions":"6.x"},{"fix":"Refer to version-specific docs on GitHub","message":"The function exported may have changed signature between Babel 6 and 7; check documentation for your version.","severity":"gotcha","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @babel/helper-plugin-test-runner or install the older babel-helper-plugin-test-runner for Babel 6","cause":"Package not installed or mistake in package name (should be @babel/helper-plugin-test-runner for Babel 7+).","error":"Cannot find module 'babel-helper-plugin-test-runner'"},{"fix":"Use import pluginTester from 'babel-helper-plugin-test-runner'","cause":"Incorrect import; the default export is a function, but maybe using named import.","error":"TypeError: pluginTester is not a function"},{"fix":"Switch to @babel/helper-plugin-test-runner","cause":"Using old package name with new Babel core.","error":"babel-helper-plugin-test-runner is not compatible with @babel/core 7+"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}