Registry / testing / ember-cli-test-loader

ember-cli-test-loader

JSON →
library3.1.0jsnpmunverified

ember-cli-test-loader is an essential Ember CLI addon designed to manage and load test modules within an Ember application. It reviews modules in `requirejs.entries` to identify and load test files, providing a customizable `shouldLoadModule` method for defining test module criteria. The current stable version is 3.1.0, which includes ambient types for improved TypeScript support. This package is fundamental for running tests in Ember CLI projects, working closely with the build system to ensure only relevant test files are loaded during the testing phase. Its release cadence typically aligns with Ember CLI updates, focusing on compatibility and necessary maintenance, rather than frequent new features. It differentiates itself by being the standard, integrated solution for test loading within the Ember ecosystem, avoiding the need for manual test file management.

npm install ember-cli-test-loader
INSTALL
IMPORT
SIG · EMBER-CLI-TEST-LOA
E
ember-cli-test-loader
testingjavascriptv3.1.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.

TestLoader
import TestLoader from 'ember-cli-test-loader/test-support';
import { TestLoader } from 'ember-cli-test-loader/test-support';
TestLoader is a default export from its test-support module.
TestLoader
import type TestLoaderType from 'ember-cli-test-loader/test-support';
Since v3.1.0, ambient types are published, allowing type imports.
TestLoader
const TestLoader = require('ember-cli-test-loader/test-support');
const { TestLoader } = require('ember-cli-test-loader/test-support');
CommonJS require style for older Node.js environments or build systems. Still imports the default export.

Demonstrates importing TestLoader and optionally overriding its 'shouldLoadModule' method before initiating the test loading process in an Ember CLI project.

import TestLoader from 'ember-cli-test-loader/test-support'; // To customize which modules are loaded as tests, override shouldLoadModule. // For example, only load files ending with '-test.js' or '-spec.js' TestLoader.prototype.shouldLoadModule = function(moduleName) { const isTestFile = moduleName.endsWith('-test.js') || moduleName.endsWith('-spec.js'); // You might also check if the module is within a specific 'tests/' directory structure // if (!moduleName.startsWith('your-app/tests/')) return false; return isTestFile && !moduleName.includes('/node_modules/'); }; // Load all identified test modules TestLoader.load(); console.log('Test modules loaded.'); // In a real Ember app, this would be part of your `tests/test-helper.js`
Debug
Known issues
breakingVersion 3.0.0 dropped support for Node.js versions 6 and 8. Projects using these older Node versions will encounter errors.
fix
Upgrade Node.js to version 10 or greater. The package officially supports Node.js 10.* || >= 12.
affects: >=3.0.0
breakingVersion 3.0.0 updated the `ember-cli-babel` requirement from `^6.8.1` to `^7.1.3`. Ensure your project's `ember-cli-babel` dependency meets this new minimum to avoid build failures.
fix
Update `ember-cli-babel` in your project's `package.json` to a compatible version (e.g., `^7.1.3` or later) and reinstall dependencies.
affects: >=3.0.0
gotchaThis addon relies on `requirejs.entries` and the Ember CLI build pipeline. Using `ember-cli-test-loader` in a non-Ember or non-RequireJS environment will likely result in runtime errors as the global `requirejs` object or its entries will not be available.
fix
Ensure this package is used within a standard Ember CLI project setup where the `requirejs` global is correctly initialized by the build system.
affects: All versions
Errors
Common errors & fixes
ReferenceError: requirejs is not defined
The package is being used outside of an Ember CLI project context where the `requirejs` global object is not available.
fix
Ensure `ember-cli-test-loader` is only used within an Ember CLI application or addon's testing setup, typically in `tests/test-helper.js`.
Error: The 'engines' field in package.json is incompatible with your current node version.
Your Node.js environment is older than the minimum required by `ember-cli-test-loader` v3.0.0+.
fix
Upgrade Node.js to version 10 or higher. The `engines.node` field specifies `10.* || >= 12`.
ReferenceError: TestLoader is not defined
The `TestLoader` object was not correctly imported before being used.
fix
Add `import TestLoader from 'ember-cli-test-loader/test-support';` to the top of your test helper file.
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
ember-cli-babelrequiredRequired for Babel compilation of Ember CLI assets, explicitly updated in v3.0.0 breaking change.
ember-clirequiredPeer dependency for all Ember CLI addons.
Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-test-loader — npm install ember-cli-test-loader · libregistry