UNPKG

1.86 kBMarkdownView Raw
1aot-test-generators
2==============================================================================
3
4[![Build Status](https://travis-ci.org/ember-cli/aot-test-generators.svg?branch=master)](https://travis-ci.org/ember-cli/aot-test-generators)
5[![npm](https://img.shields.io/npm/v/aot-test-generators.svg)](https://www.npmjs.com/package/aot-test-generators)
6
7> Generate test suites for checks that already happened at build-time
8
9
10Install
11-------------------------------------------------------------------------------
12
13```
14npm install --save aot-test-generators
15```
16
17
18Usage
19-------------------------------------------------------------------------------
20
21```js
22const testGenerators = require('aot-test-generators');
23
24let test = testGenerators.qunit.test('5 is not 42', true);
25
26console.log(test);
27// QUnit.test('test-name', function(assert) {
28// assert.expect(1);
29// assert.ok(true, 'assertion-message');
30// });
31```
32
33`aot-test-generators` currently supports:
34
35- [Mocha](https://mochajs.org/) (exported as `mocha`).
36- [QUnit](https://qunitjs.com/) (exported as `qunit`)
37
38
39API
40-------------------------------------------------------------------------------
41
42### test(testName, passed, [assertionMessage])
43
44Generates code for passing and failing tests.
45
46#### testName
47
48Type: `string`
49
50Name of the test.
51
52#### passed
53
54Type: `boolean`
55
56`true` generates a passing test, `false` generates a failing test.
57
58#### assertionMessage
59
60Type: `string`<br>
61Default: same as `testName`
62
63Assertion message inside of the test.
64
65
66### suiteHeader(suiteName)
67
68Generates test suite header code.
69
70#### suiteName
71
72Type: `string`
73
74Name of the test suite.
75
76
77### suiteFooter()
78
79Generates test suite footer code (if necessary).
80
81
82License
83-------------------------------------------------------------------------------
84
85This project is licensed under the [Apache License 2.0](LICENSE).