https://github.com/ember-cli/aot-test-generators
Generate test suites for checks that already happened at build-time
https://github.com/ember-cli/aot-test-generators
Last synced: 9 months ago
JSON representation
Generate test suites for checks that already happened at build-time
- Host: GitHub
- URL: https://github.com/ember-cli/aot-test-generators
- Owner: ember-cli
- License: apache-2.0
- Created: 2017-05-04T10:38:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-21T17:15:54.000Z (over 7 years ago)
- Last Synced: 2025-06-05T00:20:00.386Z (10 months ago)
- Language: TypeScript
- Size: 47.9 KB
- Stars: 0
- Watchers: 14
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
aot-test-generators
==============================================================================
[](https://travis-ci.org/ember-cli/aot-test-generators)
[](https://www.npmjs.com/package/aot-test-generators)
> Generate test suites for checks that already happened at build-time
Install
-------------------------------------------------------------------------------
```
npm install --save aot-test-generators
```
Usage
-------------------------------------------------------------------------------
```js
const testGenerators = require('aot-test-generators');
let test = testGenerators.qunit.test('5 is not 42', true);
console.log(test);
// QUnit.test('test-name', function(assert) {
// assert.expect(1);
// assert.ok(true, 'assertion-message');
// });
```
`aot-test-generators` currently supports:
- [Mocha](https://mochajs.org/) (exported as `mocha`).
- [QUnit](https://qunitjs.com/) (exported as `qunit`)
API
-------------------------------------------------------------------------------
### test(testName, passed, [assertionMessage])
Generates code for passing and failing tests.
#### testName
Type: `string`
Name of the test.
#### passed
Type: `boolean`
`true` generates a passing test, `false` generates a failing test.
#### assertionMessage
Type: `string`
Default: same as `testName`
Assertion message inside of the test.
### suiteHeader(suiteName)
Generates test suite header code.
#### suiteName
Type: `string`
Name of the test suite.
### suiteFooter()
Generates test suite footer code (if necessary).
License
-------------------------------------------------------------------------------
This project is licensed under the [Apache License 2.0](LICENSE).