{"id":25950,"library":"mocha-traceur","title":"mocha-traceur","description":"A Mocha plugin that compiles JavaScript files through the Traceur transpiler, enabling ES6 (ES2015) features for test files. Version 2.1.0 is the current stable release, depending on 'traceur-runner' for stack traces and optional dependency compilation. It operates via Mocha's --compilers flag. Key differentiator vs alternatives like babel-register: focused solely on Traceur, with no dependency compilation by default, making it lightweight but restrictive. The package is maintained infrequently; latest release 2.1.0 is several years old. Does not bundle Traceur itself, requiring a separate install.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/domenic/mocha-traceur","tags":["javascript","mocha","traceur","es6","compiler"],"install":[{"cmd":"npm install mocha-traceur","lang":"bash","label":"npm"},{"cmd":"yarn add mocha-traceur","lang":"bash","label":"yarn"},{"cmd":"pnpm add mocha-traceur","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides stack-trace rewriting and optional dependency compilation with Traceur.","package":"traceur-runner","optional":true}],"imports":[{"note":"Not a module import; used solely via Mocha's CLI --compilers flag. No programmatic usage.","wrong":"require('mocha-traceur')","symbol":"mocha-traceur (plugin)","correct":"mocha --compilers js:mocha-traceur my_test_dir/*.js"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev mocha mocha-traceur traceur\n\n// Create a test file 'test/test.js' with ES6 features\nimport { strictEqual } from 'assert';\n\nconst greet = (name) => `Hello, ${name}!`;\ndescribe('greet', () => {\n  it('should greet a person', () => {\n    strictEqual(greet('World'), 'Hello, World!');\n  });\n});\n\n// Run tests from command line\nmocha --compilers js:mocha-traceur test/*.js","lang":"javascript","description":"Setup and run Mocha tests with Traceur transpilation via --compilers flag, demonstrating ES6 arrow functions and template literals."},"warnings":[{"fix":"Use only transpiled dependencies, or switch to babel-register which can transpile node_modules via ignore patterns.","message":"Dependencies under node_modules are NOT compiled with Traceur. If your code imports from an ES6-only package not transpiled, it will fail at runtime.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Migrate to a modern transpiler like Babel with @babel/register.","message":"Traceur Compiler is no longer actively maintained. Prefer Babel or TypeScript for ES6+ transpilation.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Run: npm install --save-dev traceur or traceur-runner","message":"The package does not include Traceur itself. You must install traceur separately, or use traceur-runner (optional) to add stack trace support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all dependencies are pre-transpiled, or pin to v1.x if dependency transpilation is required.","message":"In v2, dependencies are no longer compiled. If you relied on dependency transpilation in v1, tests may break after upgrading.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install --save-dev traceur","cause":"The package does not bundle Traceur; it must be installed separately.","error":"Error: Cannot find module 'traceur'"},{"fix":"Use command: mocha --compilers js:mocha-traceur test/*.js (ensure the flag uses the correct path to mocha-traceur).","cause":"Mocha does not natively support ES6 modules. The --compilers flag may not be applied correctly, or the plugin isn't loading.","error":"Error: Unexpected token import"},{"fix":"Ensure --compilers is set correctly and that your test files match the pattern (e.g., .js). Add 'use strict' if needed.","cause":"Traceur may not be transpiling because the file is not passed through the plugin (e.g., due to incorrect file extension or missing --compilers flag).","error":"SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}