Registry / testing / broccoli-test-helpers

broccoli-test-helpers

JSON →
library0.0.9jsnpmunverified

This package provides utilities designed to streamline the testing process for Broccoli plugins. It offers a structured approach to setting up test environments, executing plugins against predefined fixtures, and asserting their outputs. As of its latest and only stable release, version 0.0.9, the library uses a CommonJS module system. The package has not received any updates or maintenance since late 2017, indicating it is no longer actively developed or supported. Its core functionality revolves around `makeTestHelper` for orchestrating plugin runs and `cleanupBuilders` for managing test artifacts, making it a highly specialized tool for its specific use case within the older Broccoli ecosystem. Due to its early development status and prolonged abandonment, it likely lacks compatibility with modern Node.js versions, contemporary Broccoli APIs, or current JavaScript module standards (ESM).

npm install broccoli-test-helpers
INSTALL
IMPORT
SIG · BROCCOLI-TEST-HELP
B
broccoli-test-helpers
testingjavascriptv0.0.9
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.

testHelpers
const testHelpers = require('broccoli-test-helpers');
import testHelpers from 'broccoli-test-helpers';
Package is CommonJS-only; direct ESM import will fail. `testHelpers` is the module's default export object.
makeTestHelper
const { makeTestHelper } = require('broccoli-test-helpers');
import { makeTestHelper } from 'broccoli-test-helpers';
`makeTestHelper` is a property of the module's default export object, commonly destructured in CJS. ESM named import syntax will not work.
cleanupBuilders
const { cleanupBuilders } = require('broccoli-test-helpers');
import { cleanupBuilders } from 'broccoli-test-helpers';
`cleanupBuilders` is a property of the module's default export object, commonly destructured in CJS. ESM named import syntax will not work.

Demonstrates basic usage of `broccoli-test-helpers` to set up a test for a Broccoli plugin, run it against fixture files, and assert the output files and their contents using `chai`.

const testHelpers = require('broccoli-test-helpers'); const expect = require('chai').expect; const _myBroccoliPlugin = require('./lib'); // Your Broccoli plugin under test const makeTestHelper = testHelpers.makeTestHelper; const cleanupBuilders = testHelpers.cleanupBuilders; const fs = require('fs'); const path = require('path'); const fixtures = path.join(process.cwd(), 'tests/fixtures'); const assertions = path.join(process.cwd(), 'tests/expectations'); // Renamed from original for clarity describe('myBroccoliPlugin', function() { let myBroccoliPlugin; beforeEach(function() { // Setup the test helper with your plugin and fixture path myBroccoliPlugin = makeTestHelper({ subject: _myBroccoliPlugin, fixturePath: fixtures }); }); afterEach(function() { // Clean up any temporary directories created by the builder return cleanupBuilders(); }); it('should process files correctly', function() { return myBroccoliPlugin('.').then(function(result) { // Assert the list of files produced by the plugin expect(result.files).to.deep.equal([ 'a.js', 'b.js' ]); // Assert the content of each file against expectations result.files.forEach(function(file) { const actualContent = fs.readFileSync(path.join(result.directory, file), 'utf8'); const expectedContent = fs.readFileSync(path.join(assertions, file), 'utf8'); expect(actualContent).to.equal(expectedContent); }); // Example of testing a rebuild: // return result.builder().then(function(rebuildResult) { // // Perform assertions on the rebuildResult // }); }); }); });
Debug
Known issues
breakingThe `broccoli-test-helpers` package has been abandoned since late 2017. It is not compatible with modern Node.js versions (e.g., Node.js 16+), and will likely fail due to outdated dependencies or changes in core Node.js APIs.
fix
Consider migrating to a more modern testing solution for Broccoli plugins, or use an older Node.js version (e.g., Node.js 8 or 10) if you must rely on this package.
affects: >=0.0.9
breakingThis package is CommonJS-only. Attempting to `import` it in an ES Module environment will result in a `ReferenceError: require is not defined` or similar module resolution errors without explicit transpilation or custom loader configurations.
fix
Ensure your project uses CommonJS modules (`.js` files with `require`) or configure your build tools (e.g., Webpack, Rollup, Babel) to transpile the module for ESM compatibility.
affects: >=0.0.9
gotchaThe package's lack of maintenance means it is unlikely to be compatible with recent major versions of Broccoli itself. Breaking changes in Broccoli's API since 2017 may cause `broccoli-test-helpers` to malfunction or produce incorrect test results.
fix
Verify compatibility with your specific Broccoli version. If issues arise, manual adaptation or an alternative testing approach may be necessary.
affects: >=0.0.9
gotchaUsing an abandoned package from 2017 can introduce security vulnerabilities through outdated and unpatched dependencies. Supply chain attacks or known CVEs in its transitive dependencies may not have been addressed.
fix
Perform a thorough security audit of the package's dependency tree if usage is unavoidable. Prioritize migrating to actively maintained alternatives to minimize security risks.
affects: >=0.0.9
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `broccoli-test-helpers` (a CommonJS module) in an ECMAScript Module (ESM) context without proper transpilation.
fix
Convert your consuming module to CommonJS (`.js` file and `require` syntax), or use a build tool like Webpack/Rollup with Babel to handle interop. If in Node.js, ensure your package.json doesn't specify `"type": "module"` for the directory containing the test.
TypeError: Cannot read properties of undefined (reading 'makeTestHelper')
The `broccoli-test-helpers` module's default export object was not correctly imported, or the module failed to load entirely.
fix
Double-check the `require('broccoli-test-helpers')` statement for typos. Ensure the package is correctly installed (`npm install broccoli-test-helpers --save-dev`). This might also occur if an ESM `import` failed silently.
TypeError: builder.build is not a function
The `broccoli` API or the `Broccoli.Builder` class used internally by `broccoli-test-helpers` has changed in a breaking way, leading to incompatibility.
fix
This package is likely incompatible with your current Broccoli version. You may need to downgrade your Broccoli version or update your testing strategy to use a different tool or direct Broccoli APIs.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
broccoli-test-helpers — npm install broccoli-test-helpers · libregistry