包详细信息

qunit-assertions-extra

NullVoxPopuli16.5kMIT1.0.3

Collection of helpful assertions for use with qunit

qunit, qunit-plugin, testing, assertions

自述文件

qunit-assertions-extra

A Collection of helpful assertions for use with qunit.

assert.contains('Hello there!', 'Hello');
assert.contains([1, 3], 3);

assert.matches('Hello there!', /Hello/);

Installation

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.

Ember Projects

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();

Contributing

See the Contributing guide for details.

Prior Art

  • qunit-dom much of the config for this repo was taken from qunit-dom.

License

This project is licensed under the MIT License.

更新日志

qunit-assertions-extra

1.0.1

Patch Changes

1.0.0

Major Changes

  • #53 84cab58 Thanks @NullVoxPopuli! - - Convert package to ESM.
    • CJS will not formally be supported, but is still shipped, just in case folks need those files.
    • Change a bunch of internal tooling (simplified a ton)
    • Lots of long overdue basic maintenance