@exodus/test 1.0.0-rc.3 → 1.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -27
- package/bin/babel.cjs +8 -0
- package/bin/index.js +493 -58
- package/bin/jest.js +4 -0
- package/package.json +84 -16
- package/src/bundle-apis/ansi-styles.cjs +49 -0
- package/src/bundle-apis/assert-strict.cjs +1 -0
- package/src/bundle-apis/globals.cjs +58 -0
- package/src/bundle-apis/jest-message-util.js +5 -0
- package/src/bundle-apis/jest-util.js +22 -0
- package/src/bundle-apis/util-format.cjs +41 -0
- package/src/dark.cjs +145 -0
- package/src/engine.js +22 -0
- package/src/engine.node.cjs +40 -0
- package/src/engine.pure.cjs +377 -0
- package/src/engine.select.cjs +5 -0
- package/src/jest.config.fs.js +54 -0
- package/src/jest.config.js +134 -0
- package/src/jest.environment.js +72 -0
- package/src/jest.fn.js +47 -21
- package/src/jest.js +210 -0
- package/src/jest.mock.js +265 -0
- package/src/jest.snapshot.js +165 -0
- package/src/jest.timers.js +73 -0
- package/src/node.js +10 -0
- package/src/tape.js +160 -0
- package/src/version.js +17 -0
- package/bin/preload.js +0 -3
- package/bin/typescript.js +0 -3
- package/src/index.js +0 -122
package/README.md
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
# @exodus/test
|
|
2
2
|
|
|
3
|
+
A runner for `node:test`, `jest`, and `tape` test suites on top of `node:test`
|
|
4
|
+
|
|
3
5
|
Most likely it will just work on your simple jest tests as as drop-in replacement
|
|
4
6
|
|
|
7
|
+
Comes with typescript support, optional esm/cjs interop, and also loading babel transforms!
|
|
8
|
+
|
|
9
|
+
Use `--coverage` to generate coverage output
|
|
10
|
+
|
|
11
|
+
Default `NODE_ENV` value is "test", use `NODE_ENV=` to override (e.g. to empty)
|
|
12
|
+
|
|
5
13
|
## Library
|
|
6
14
|
|
|
15
|
+
### Using with `node:test` natively
|
|
16
|
+
|
|
17
|
+
You can just use pure [`node:test`](https://nodejs.org/api/test.html) in your tests,
|
|
18
|
+
this runner is fully compatible with that (and will set version-specific options for you)!
|
|
19
|
+
|
|
7
20
|
### Moving from jest
|
|
8
21
|
|
|
9
|
-
|
|
22
|
+
```js
|
|
23
|
+
import {
|
|
24
|
+
jest,
|
|
25
|
+
expect,
|
|
26
|
+
describe,
|
|
27
|
+
it,
|
|
28
|
+
beforeEach,
|
|
29
|
+
afterEach,
|
|
30
|
+
beforeAll,
|
|
31
|
+
afterAll,
|
|
32
|
+
} from '@exodus/test/jest'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or, run with [`--jest` option](#options) to register jest globals
|
|
10
36
|
|
|
11
37
|
### Moving from tap/tape
|
|
12
38
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
```js
|
|
40
|
+
import test from '@exodus/test/tap'
|
|
41
|
+
```
|
|
16
42
|
|
|
17
43
|
### Running tests asynchronously
|
|
18
44
|
|
|
@@ -20,41 +46,34 @@ Add `{ concurrency: true }`, like this: `describe('my testsuite', { concurrency:
|
|
|
20
46
|
|
|
21
47
|
### List of exports
|
|
22
48
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `jest` -- jest mock adapter
|
|
26
|
-
- `tap` -- tap/tape adapter
|
|
27
|
-
- `mock`
|
|
49
|
+
- `@exodus/test/jest` -- `jest` mock
|
|
28
50
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `assert` -- alias for `node:assert/strict`
|
|
32
|
-
- `expect` -- expect with additional features for function mocks
|
|
33
|
-
|
|
34
|
-
Suite:
|
|
35
|
-
|
|
36
|
-
- `describe`
|
|
37
|
-
- `test`
|
|
38
|
-
- `it` -- alias for `test`
|
|
39
|
-
- `beforeEach`
|
|
40
|
-
- `afterEach`
|
|
41
|
-
- `before` -- alias for `beforeAll`
|
|
42
|
-
- `after` -- alias for `afterAll`
|
|
51
|
+
- `@exodus/test/tape` -- `tape` mock (can also be helpful when moving from `tap`)
|
|
43
52
|
|
|
44
53
|
## Binary
|
|
45
54
|
|
|
46
|
-
Just use `"test: "exodus-test"`
|
|
55
|
+
Just use `"test": "exodus-test"`
|
|
47
56
|
|
|
48
57
|
### Options
|
|
49
58
|
|
|
50
|
-
- `--
|
|
59
|
+
- `--jest` -- register jest test helpers as global variables, also load `jest.config.*` configuration options
|
|
51
60
|
|
|
52
|
-
- `--
|
|
61
|
+
- `--esbuild` -- use esbuild loader, also enables Typescript support
|
|
53
62
|
|
|
54
|
-
- `--babel` --
|
|
63
|
+
- `--babel` -- use babel loader (slower than `--esbuild`, makes sense if you have a special config)
|
|
55
64
|
|
|
56
65
|
- `--coverage` -- enable coverage, prints coverage output (varies by coverage engine)
|
|
57
66
|
|
|
58
67
|
- `--coverage-engine c8` -- use c8 coverage engine (default), also generates `./coverage/` dirs
|
|
59
68
|
|
|
60
69
|
- `--coverage-engine node` -- use Node.js builtint coverage engine
|
|
70
|
+
|
|
71
|
+
- `--watch` -- operate in watch mode and re-run tests on file changes
|
|
72
|
+
|
|
73
|
+
- `--only` -- only run the tests marked with `test.only`
|
|
74
|
+
|
|
75
|
+
- `--passWithNoTests` -- do not error when no test files were found
|
|
76
|
+
|
|
77
|
+
- `--write-snapshots` -- write snapshots instead of verifying them (has `--test-update-snapshots` alias)
|
|
78
|
+
|
|
79
|
+
- `--test-force-exit` -- force exit after tests are done (useful in integration tests where it could be unfeasible to resolve all open handles)
|