@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 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
- `import { describe, it, assert, jest, expect } from '@exodus/test'`
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
- `import { tap as test } from '@exodus/test'`
14
-
15
- Not all features might be supported
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
- Adapters:
24
-
25
- - `jest` -- jest mock adapter
26
- - `tap` -- tap/tape adapter
27
- - `mock`
49
+ - `@exodus/test/jest` -- `jest` mock
28
50
 
29
- Assertions:
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
- - `--global` -- register all test helpers as global variables
59
+ - `--jest` -- register jest test helpers as global variables, also load `jest.config.*` configuration options
51
60
 
52
- - `--typescript` -- enable typescript support
61
+ - `--esbuild` -- use esbuild loader, also enables Typescript support
53
62
 
54
- - `--babel` -- enable babel support
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)
package/bin/babel.cjs ADDED
@@ -0,0 +1,8 @@
1
+ const register = require('@babel/register')
2
+
3
+ register({
4
+ compact: false,
5
+ babelrc: false,
6
+ plugins: ['@babel/plugin-transform-modules-commonjs'],
7
+ ignore: [], // do not ignore node_modules
8
+ })