Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charmander/test
Node package for test grouping
https://github.com/charmander/test
nodejs
Last synced: 3 months ago
JSON representation
Node package for test grouping
- Host: GitHub
- URL: https://github.com/charmander/test
- Owner: charmander
- License: isc
- Created: 2018-02-07T04:05:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-12T05:15:18.000Z (over 5 years ago)
- Last Synced: 2024-08-09T18:34:52.893Z (5 months ago)
- Topics: nodejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/@charmander/test
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Organizes and runs tests.
> [!WARNING]
> Deprecated in favor of the built-in [node:test][].[node:test]: https://nodejs.org/docs/latest/api/test.html
## Usage
```javascript
'use strict';const assert = require('assert');
const test = require('@charmander/test')(module);test('synchronous test, no return value', () => {
assert(1 < 2);
});test('asynchronous test, promise return value', async () => {
const n = await Promise.resolve(2);
assert(1 < n);
});
```or
```javascript
const describe = require('@charmander/test/describe')(module);describe('thing', it => {
it('behaves', () => {
assert(1 < 2);
});
});
```Running `node path/to/test-module.js` will run tests in that module. Test modules export an array of test objects, which have a `name` property and a `.run()` method. `.run()` returns a promise that rejects with a test error or resolves with `undefined`.
[ci]: https://travis-ci.org/charmander/test
[ci image]: https://api.travis-ci.org/charmander/test.svg