Registry / testing / broccoli-test-builder

broccoli-test-builder

JSON →
library0.4.0jsnpmunverified

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.

npm install broccoli-test-builder
INSTALL
IMPORT
SIG · BROCCOLI-TEST-BUIL
B
broccoli-test-builder
testingjavascriptv0.4.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.

testBuilder
const testBuilder = require('broccoli-test-builder');
import testBuilder from 'broccoli-test-builder';
This package exclusively uses CommonJS `require` syntax. There is no ESM export.
build
const testTree = testBuilder.build(options);
import { build } from 'broccoli-test-builder';
`build` is a method on the default export, not a named export. The package is CJS only.

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.

const testBuilder = require('broccoli-test-builder'); const Funnel = require('broccoli-funnel'); const mergeTrees = require('broccoli-merge-trees'); // Assume your application's source code is in a 'app' directory // and tests are in a 'tests' directory. const appTree = new Funnel('app', { destDir: 'lib' }); const testFilesTree = new Funnel('tests', { exclude: ['index.html'] }); const testIndexHtml = new Funnel('tests', { include: ['index.html'] }); const options = { libDirName: 'lib', // Path to your source code, defaulted to 'lib' // Other options like 'eslintOptions' can be passed here }; // Build the test tree const builtTestTree = testBuilder.build(options); // Merge your app code, the built test tree, and the test index.html module.exports = mergeTrees([appTree, testFilesTree, builtTestTree, testIndexHtml], { overwrite: true });
Debug
Known issues
breakingThis 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).
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.
affects: All versions
gotchaThe 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.
fix
Ensure your project structure adheres to the default `lib/` and `tests/` directories, or explicitly configure `options.libDirName` if your source code resides elsewhere.
affects: All versions
gotchaThe `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.
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`.
affects: All versions
deprecatedThe 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.
fix
If linting is critical, manage it externally with ESLint directly in your project configuration, rather than relying on this package's internal linting.
affects: All versions
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an environment that only supports ES Modules (e.g., a modern Node.js module or browser script type="module").
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.
Error: ENOENT: no such file or directory, stat 'lib/'
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.
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.
Build failed. Error: Path '...' does not exist.
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`.
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).
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
broccoli-lint-eslintrequiredUsed internally for linting source and test code with JSHint.
babelrequiredImplied dependency for transpiling ES6 to ES5.
qunitrequiredBundled as part of the test runner setup.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources