@aljazmc/testero 0.3.3 → 0.4.1
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 +86 -39
- package/bin/main.js +2284 -2010
- package/bin/types/ambient.d.ts +35 -0
- package/bin/types/collector.d.ts +3 -1
- package/package.json +6 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The globals of test files, for tsconfig's `types` as `@aljazmc/testero/globals`. */
|
|
2
|
+
import type { DescribeApi, TestApi } from "./collector.js";
|
|
3
|
+
import type Expect from "./expect/expect.js";
|
|
4
|
+
import type Mocks from "./mock.js";
|
|
5
|
+
import type { Body } from "./suite.js";
|
|
6
|
+
type Hook = (body: Body, timeout?: number) => void;
|
|
7
|
+
/** `testero` and `jest`, their methods return them to chain calls. */
|
|
8
|
+
interface Testero {
|
|
9
|
+
fn: typeof Mocks.fn;
|
|
10
|
+
spyOn: typeof Mocks.spyOn;
|
|
11
|
+
isMockFunction: typeof Mocks.isMockFunction;
|
|
12
|
+
clearAllMocks(): Testero;
|
|
13
|
+
resetAllMocks(): Testero;
|
|
14
|
+
restoreAllMocks(): Testero;
|
|
15
|
+
/** Sets the timeout of the tests and hooks of this file. */
|
|
16
|
+
setTimeout(timeout: number): Testero;
|
|
17
|
+
}
|
|
18
|
+
declare global {
|
|
19
|
+
const describe: DescribeApi;
|
|
20
|
+
const fdescribe: DescribeApi["only"];
|
|
21
|
+
const xdescribe: DescribeApi["skip"];
|
|
22
|
+
const test: TestApi;
|
|
23
|
+
const it: TestApi;
|
|
24
|
+
const fit: TestApi["only"];
|
|
25
|
+
const xit: TestApi["skip"];
|
|
26
|
+
const xtest: TestApi["skip"];
|
|
27
|
+
const beforeAll: Hook;
|
|
28
|
+
const afterAll: Hook;
|
|
29
|
+
const beforeEach: Hook;
|
|
30
|
+
const afterEach: Hook;
|
|
31
|
+
const expect: ReturnType<Expect["create"]>;
|
|
32
|
+
const testero: Testero;
|
|
33
|
+
const jest: Testero;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
package/bin/types/collector.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Body, type HookKind, Suite } from "./suite.js";
|
|
2
2
|
type TestFunction = (name: string, body?: Body, timeout?: number) => void;
|
|
3
3
|
type DescribeFunction = (name: string, body: () => unknown) => void;
|
|
4
|
-
type
|
|
4
|
+
type Row = (...args: any[]) => unknown;
|
|
5
|
+
/** `each` takes a table, then declares a test or suite for each of its rows. */
|
|
6
|
+
type Table = (table: unknown, ...values: unknown[]) => (name: string, body: Row, timeout?: number) => void;
|
|
5
7
|
/** `test` and `it`, with `only`, `skip`, `todo` and `each`. */
|
|
6
8
|
export interface TestApi extends TestFunction {
|
|
7
9
|
only: TestFunction & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aljazmc/testero",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"modular"
|
|
21
21
|
],
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": "^22.18.0 || ^24 || ^25 || ^26"
|
|
23
|
+
"node": "^22.18.0 || ^24.2.0 || ^25 || ^26"
|
|
24
24
|
},
|
|
25
25
|
"types": "./bin/types/testero.d.ts",
|
|
26
26
|
"bin": "./bin/main.js",
|
|
@@ -29,14 +29,17 @@
|
|
|
29
29
|
"types": "./bin/types/testero.d.ts",
|
|
30
30
|
"default": "./bin/main.js"
|
|
31
31
|
},
|
|
32
|
+
"./globals": {
|
|
33
|
+
"types": "./bin/types/ambient.d.ts"
|
|
34
|
+
},
|
|
32
35
|
"./package.json": "./package.json"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@aljazmc/config": "0.2.0",
|
|
36
38
|
"@jest/globals": "^30.5.2",
|
|
37
39
|
"@types/node": "^26.6.5"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
42
|
+
"@aljazmc/config": "^0.3.0",
|
|
40
43
|
"esbuild": "0.28.2"
|
|
41
44
|
}
|
|
42
45
|
}
|