{"id":12908,"library":"broccoli-test-builder","title":"Broccoli Test Builder","description":"broccoli-test-builder is a Broccoli.js plugin designed to construct a build tree specifically for running JavaScript tests. It aggregates test-related assets, including source code, test files, and necessary testing frameworks. The package transpiles ES6 source and test code into ES5 using Babel, runs linting with JSHint via `broccoli-lint-eslint`, and bundles test files into AMD modules, concating them into `tests/built-amd-tests.js`. It also includes an AMD loader, QUnit (JavaScript and CSS), and a test-loader, expecting a user-provided `tests/index.html` that uses specific variable markers for content injection. At version 0.4.0, this package is likely tied to older Broccoli.js ecosystems and JavaScript development practices, such as ES5 targeting and AMD modules, and is no longer actively maintained for modern web development workflows.","status":"abandoned","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/bustlelabs/broccoli-test-builder","tags":["javascript","broccoli-plugin"],"install":[{"cmd":"npm install broccoli-test-builder","lang":"bash","label":"npm"},{"cmd":"yarn add broccoli-test-builder","lang":"bash","label":"yarn"},{"cmd":"pnpm add broccoli-test-builder","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for linting source and test code with JSHint.","package":"broccoli-lint-eslint","optional":false},{"reason":"Implied dependency for transpiling ES6 to ES5.","package":"babel","optional":false},{"reason":"Bundled as part of the test runner setup.","package":"qunit","optional":false}],"imports":[{"note":"This package exclusively uses CommonJS `require` syntax. There is no ESM export.","wrong":"import testBuilder from 'broccoli-test-builder';","symbol":"testBuilder","correct":"const testBuilder = require('broccoli-test-builder');"},{"note":"`build` is a method on the default export, not a named export. The package is CJS only.","wrong":"import { build } from 'broccoli-test-builder';","symbol":"build","correct":"const testTree = testBuilder.build(options);"}],"quickstart":{"code":"const testBuilder = require('broccoli-test-builder');\nconst Funnel = require('broccoli-funnel');\nconst mergeTrees = require('broccoli-merge-trees');\n\n// Assume your application's source code is in a 'app' directory\n// and tests are in a 'tests' directory.\nconst appTree = new Funnel('app', { destDir: 'lib' });\nconst testFilesTree = new Funnel('tests', { exclude: ['index.html'] });\nconst testIndexHtml = new Funnel('tests', { include: ['index.html'] });\n\nconst options = {\n  libDirName: 'lib', // Path to your source code, defaulted to 'lib'\n  // Other options like 'eslintOptions' can be passed here\n};\n\n// Build the test tree\nconst builtTestTree = testBuilder.build(options);\n\n// Merge your app code, the built test tree, and the test index.html\nmodule.exports = mergeTrees([appTree, testFilesTree, builtTestTree, testIndexHtml], { overwrite: true });","lang":"javascript","description":"This quickstart demonstrates how to integrate `broccoli-test-builder` into a basic `Brocfile.js` setup, funneling application and test files, then merging them with the output of the test builder. It highlights the CommonJS import and the `build` method."},"warnings":[{"fix":"Consider migrating to a modern testing setup (e.g., Jest, Vitest, Cypress, Playwright) and build tools if not strictly bound to an older Ember CLI or Broccoli.js project.","message":"This package is designed for older Broccoli.js versions and relies on deprecated JavaScript tooling (e.g., JSHint, older Babel configurations for ES6-to-ES5 transpilation, QUnit). It is not compatible with modern JavaScript development environments (ESM, current Babel presets, modern test runners).","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure your project structure adheres to the default `lib/` and `tests/` directories, or explicitly configure `options.libDirName` if your source code resides elsewhere.","message":"The package assumes a specific directory structure (`lib/` for source, `tests/` for test code). While `libDirName` can be configured, deviations may lead to files not being processed correctly or not found during the build.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the package's README for the exact `index.html` template and ensure all `@@VARIABLE_MARKERS` are present and correctly formatted in your test `index.html`.","message":"The `index.html` for tests must include specific `@@VARIABLE_MARKERS` (e.g., `@@QUNIT_CSS`, `@@LOADER_JS`) for the builder to inject the generated assets. Failure to include these markers or using incorrect ones will result in a broken test page.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If linting is critical, manage it externally with ESLint directly in your project configuration, rather than relying on this package's internal linting.","message":"The package internally uses `broccoli-lint-eslint` which, despite its name, is configured to run JSHint. JSHint is a largely deprecated linter for modern JavaScript projects.","severity":"deprecated","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"This package is CommonJS only. Ensure your build process or execution environment supports CommonJS `require()` statements. This package is not compatible with pure ESM projects.","cause":"Attempting to use `require()` in an environment that only supports ES Modules (e.g., a modern Node.js module or browser script type=\"module\").","error":"ReferenceError: require is not defined"},{"fix":"Ensure your source code is placed in a `lib/` directory relative to your Brocfile, or specify the correct path using `options.libDirName` in the `build()` call.","cause":"The `broccoli-test-builder` defaults to looking for source code in a directory named `lib/`. If this directory does not exist or is empty, this error will occur.","error":"Error: ENOENT: no such file or directory, stat 'lib/'"},{"fix":"Verify that your `broccoli-funnel` or similar input tree configurations correctly point to existing directories and files, and that the `destDir` matches what `broccoli-test-builder` expects (e.g., `lib` for source).","cause":"Often related to incorrect `Funnel` paths or `destDir` configurations for the input trees (e.g., application code or test files) before passing them to `broccoli-test-builder`.","error":"Build failed. Error: Path '...' does not exist."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}