1 | aot-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 |
|
10 | Install
|
11 | -------------------------------------------------------------------------------
|
12 |
|
13 | ```
|
14 | npm install --save aot-test-generators
|
15 | ```
|
16 |
|
17 |
|
18 | Usage
|
19 | -------------------------------------------------------------------------------
|
20 |
|
21 | ```js
|
22 | const testGenerators = require('aot-test-generators');
|
23 |
|
24 | let test = testGenerators.qunit.test('5 is not 42', true);
|
25 |
|
26 | console.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 |
|
39 | API
|
40 | -------------------------------------------------------------------------------
|
41 |
|
42 | ### test(testName, passed, [assertionMessage])
|
43 |
|
44 | Generates code for passing and failing tests.
|
45 |
|
46 | #### testName
|
47 |
|
48 | Type: `string`
|
49 |
|
50 | Name of the test.
|
51 |
|
52 | #### passed
|
53 |
|
54 | Type: `boolean`
|
55 |
|
56 | `true` generates a passing test, `false` generates a failing test.
|
57 |
|
58 | #### assertionMessage
|
59 |
|
60 | Type: `string`<br>
|
61 | Default: same as `testName`
|
62 |
|
63 | Assertion message inside of the test.
|
64 |
|
65 |
|
66 | ### suiteHeader(suiteName)
|
67 |
|
68 | Generates test suite header code.
|
69 |
|
70 | #### suiteName
|
71 |
|
72 | Type: `string`
|
73 |
|
74 | Name of the test suite.
|
75 |
|
76 |
|
77 | ### suiteFooter()
|
78 |
|
79 | Generates test suite footer code (if necessary).
|
80 |
|
81 |
|
82 | License
|
83 | -------------------------------------------------------------------------------
|
84 |
|
85 | This project is licensed under the [Apache License 2.0](LICENSE).
|