A Collection of helpful assertions for use with qunit.
assert.contains('Hello there!', 'Hello');
assert.contains([1, 3], 3);
assert.matches('Hello there!', /Hello/);
yarn add --dev qunit-assertions-extra
npm install --save-dev qunit-assertions-extra
Then, wherever qunit tests are initialized, add
import * as QUnit from 'qunit';
import { setup } from 'qunit-assertions-extra';
setup(QUnit.assert);
This will also enable the tsserver to provide intellisense for assert
.
Requirements: ember-auto-import and add the above import to your tests/test-helper.js
file.
Example:
import Application from '../app';
import * as QUnit from 'qunit';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
import { setup } from 'qunit-assertions-extra';
setup(QUnit.assert);
setApplication(Application.create(config.APP));
start();
See the Contributing guide for details.
- qunit-dom much of the config for this repo was taken from qunit-dom.
This project is licensed under the MIT License.