{"id":12910,"library":"broccoli-test-helpers","title":"Broccoli Test Helpers","description":"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).","status":"abandoned","version":"0.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/chadhietala/broccoli-test-helpers","tags":["javascript","broccoli"],"install":[{"cmd":"npm install broccoli-test-helpers","lang":"bash","label":"npm"},{"cmd":"yarn add broccoli-test-helpers","lang":"bash","label":"yarn"},{"cmd":"pnpm add broccoli-test-helpers","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CommonJS-only; direct ESM import will fail. `testHelpers` is the module's default export object.","wrong":"import testHelpers from 'broccoli-test-helpers';","symbol":"testHelpers","correct":"const testHelpers = require('broccoli-test-helpers');"},{"note":"`makeTestHelper` is a property of the module's default export object, commonly destructured in CJS. ESM named import syntax will not work.","wrong":"import { makeTestHelper } from 'broccoli-test-helpers';","symbol":"makeTestHelper","correct":"const { makeTestHelper } = require('broccoli-test-helpers');"},{"note":"`cleanupBuilders` is a property of the module's default export object, commonly destructured in CJS. ESM named import syntax will not work.","wrong":"import { cleanupBuilders } from 'broccoli-test-helpers';","symbol":"cleanupBuilders","correct":"const { cleanupBuilders } = require('broccoli-test-helpers');"}],"quickstart":{"code":"const testHelpers = require('broccoli-test-helpers');\nconst expect = require('chai').expect;\nconst _myBroccoliPlugin = require('./lib'); // Your Broccoli plugin under test\nconst makeTestHelper = testHelpers.makeTestHelper;\nconst cleanupBuilders = testHelpers.cleanupBuilders;\nconst fs = require('fs');\nconst path = require('path');\n\nconst fixtures = path.join(process.cwd(), 'tests/fixtures');\nconst assertions = path.join(process.cwd(), 'tests/expectations'); // Renamed from original for clarity\n\ndescribe('myBroccoliPlugin', function() {\n  let myBroccoliPlugin;\n\n  beforeEach(function() {\n    // Setup the test helper with your plugin and fixture path\n    myBroccoliPlugin = makeTestHelper({\n      subject: _myBroccoliPlugin,\n      fixturePath: fixtures\n    });\n  });\n\n  afterEach(function() {\n    // Clean up any temporary directories created by the builder\n    return cleanupBuilders();\n  });\n\n  it('should process files correctly', function() {\n    return myBroccoliPlugin('.').then(function(result) {\n      // Assert the list of files produced by the plugin\n      expect(result.files).to.deep.equal([\n        'a.js',\n        'b.js'\n      ]);\n\n      // Assert the content of each file against expectations\n      result.files.forEach(function(file) {\n        const actualContent = fs.readFileSync(path.join(result.directory, file), 'utf8');\n        const expectedContent = fs.readFileSync(path.join(assertions, file), 'utf8');\n        expect(actualContent).to.equal(expectedContent);\n      });\n\n      // Example of testing a rebuild:\n      // return result.builder().then(function(rebuildResult) {\n      //   // Perform assertions on the rebuildResult\n      // });\n    });\n  });\n});","lang":"javascript","description":"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`."},"warnings":[{"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.","message":"The `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.","severity":"breaking","affected_versions":">=0.0.9"},{"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.","message":"This 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.","severity":"breaking","affected_versions":">=0.0.9"},{"fix":"Verify compatibility with your specific Broccoli version. If issues arise, manual adaptation or an alternative testing approach may be necessary.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.9"},{"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.","message":"Using 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.","severity":"gotcha","affected_versions":">=0.0.9"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"Attempting to use `broccoli-test-helpers` (a CommonJS module) in an ECMAScript Module (ESM) context without proper transpilation.","error":"ReferenceError: require is not defined"},{"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.","cause":"The `broccoli-test-helpers` module's default export object was not correctly imported, or the module failed to load entirely.","error":"TypeError: Cannot read properties of undefined (reading 'makeTestHelper')"},{"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.","cause":"The `broccoli` API or the `Broccoli.Builder` class used internally by `broccoli-test-helpers` has changed in a breaking way, leading to incompatibility.","error":"TypeError: builder.build is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}