ember-addon-test v0.0.0-alpha.1
ember-addon-test
https://www.npmjs.com/package/ember-addon-test
Test your v2 ember-addons with ease without any boilerplate files.
Running Tests
In your addon's directory, run:
pnpm addon-test
or
yarn addon-test
or
npm exec addon-test
In CI
Tests will run to completion with exit status 0 for success and 1 for failure. This is determined by ci-info in the shell env.
Conventions
a file named /tests/setup.ts
must exist so that your tests can be bootstrapped.
It should contain your test setup and import all your test files. This is powered by vite, so we can import all tests with one line. Minimally, you'll want something like this:
import * as QUnit from 'qunit';
import { setup } from 'qunit-dom';
setup(QUnit.assert);
import.meta.glob('./**/*test.{js,ts}', { eager: true });
For adding types for import.meta
, you'll need to install vite
and
following these instructions
Using your own vite.config.mts
mts is required because only ESM is supported. By default .ts files in node are converted to CJS, even if they use imports. Using the mts
extension prevents this.
You can import the plugins provided by this library for your own vite config like this:
// vite.config.mts
import { defineConfig } from 'vite';
import { addonTest } from 'ember-addon-test';
export default defineConfig({
plugins: [
...addonTest(),
],
});
Testing against multiple ember versions / compiler settings
This is not supported at this time, ember-addon-test is still considered experimental, and doesn't yet support swapping out the ember-source version (yet). Testing against different ember versions is a great need for the entire ecosystem, so this will be implemented eventually.
2 years ago
2 years ago