@aljazmc/testero 0.3.1 → 0.3.3
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 +18 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
    
|
|
2
2
|
|
|
3
3
|
# > testero
|
|
4
4
|
|
|
5
|
-
A simple, Jest-like test runner. Easy to understand, easy to customize and easy to extend.
|
|
5
|
+
A simple, Jest-like test runner for JavaScript, TypeScript and JSX, compiling tests with esbuild. Easy to understand, easy to customize and easy to extend.
|
|
6
6
|
|
|
7
|
-
## >
|
|
7
|
+
## > Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install --save-dev @aljazmc/testero
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## > Usage
|
|
8
14
|
|
|
9
15
|
```sh
|
|
10
16
|
testero # run every test file
|
|
@@ -16,7 +22,9 @@ testero --config # write the defaults to testero.config.ts, --config j
|
|
|
16
22
|
testero --help
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
## > Writing tests
|
|
26
|
+
|
|
27
|
+
testero runs test files written in JavaScript, TypeScript or JSX, with the same globals as [Jest](https://jestjs.io):
|
|
20
28
|
|
|
21
29
|
```ts
|
|
22
30
|
import { add } from "../src/math.ts";
|
|
@@ -49,9 +57,11 @@ describe("add", () => {
|
|
|
49
57
|
- asymmetric matchers: `expect.any`, `expect.anything`, `expect.objectContaining`, `expect.arrayContaining`, `expect.stringContaining`, `expect.stringMatching`, `expect.closeTo` and their `expect.not` variants
|
|
50
58
|
- `testero.fn`, `testero.spyOn`, `testero.clearAllMocks`, `testero.resetAllMocks`, `testero.restoreAllMocks` and `testero.setTimeout`, also as `jest`; imports from `@jest/globals` get the same functions
|
|
51
59
|
|
|
52
|
-
|
|
60
|
+
testero reports each failure with its message, a diff of the expected and received values, and the code where it happened.
|
|
61
|
+
|
|
62
|
+
## > Configuration
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
testero reads `testero.config.ts` or `testero.config.js` from the current directory, with Jest's names and defaults. Objects are merged deeply into the defaults, anything else (like `ignore`) replaces them:
|
|
55
65
|
|
|
56
66
|
```js
|
|
57
67
|
export default {
|
|
@@ -73,7 +83,7 @@ export default {
|
|
|
73
83
|
};
|
|
74
84
|
```
|
|
75
85
|
|
|
76
|
-
## >
|
|
86
|
+
## > How it works
|
|
77
87
|
|
|
78
88
|
- `src/transformer.ts`: bundles each test file and the local files it imports with [esbuild](https://esbuild.github.io), the only dependency, into one module; installed packages stay external and the globals are injected where the file uses them
|
|
79
89
|
- `src/collector.ts`: the `describe`, `test` and hook functions, collecting what a test file declares into a tree of suites (`src/suite.ts`)
|
|
@@ -84,4 +94,4 @@ export default {
|
|
|
84
94
|
- `src/testero.ts`: finds the test files and runs them one after another
|
|
85
95
|
- `@aljazmc/config` (`shared/config`): loads `testero.config.ts`, finds the files and matches `testMatch`, shared with every package
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
testero bundles each test file on its own, so it gets fresh copies of the files it imports, and spies are restored after it. Test files run one after another in one process, without workers, module mocking, fake timers, snapshots or coverage.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aljazmc/testero",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "A simple, Jest
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"description": "A simple, Jest-like test runner for JavaScript, TypeScript and JSX, compiling tests with esbuild. Easy to understand, easy to customize and easy to extend.",
|
|
5
5
|
"author": "aljazmc",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|