@japa/runner 3.0.0-7 → 3.0.0-9
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/build/examples/dot.d.ts +1 -0
- package/build/examples/dot.js +11 -0
- package/build/examples/ndjson.d.ts +1 -0
- package/build/examples/ndjson.js +11 -0
- package/build/examples/spec.d.ts +1 -0
- package/build/examples/spec.js +11 -0
- package/build/factories/create_diverse_tests.d.ts +6 -0
- package/build/factories/create_diverse_tests.js +106 -0
- package/build/factories/main.d.ts +3 -0
- package/build/factories/main.js +12 -0
- package/build/factories/runner.d.ts +7 -8
- package/build/factories/runner.js +16 -129
- package/build/modules/core/main.d.ts +1 -0
- package/build/src/config_manager.js +1 -1
- package/build/src/debug.d.ts +1 -1
- package/build/src/files_manager.d.ts +1 -1
- package/build/src/helpers.d.ts +14 -21
- package/build/src/helpers.js +26 -2
- package/build/src/planner.d.ts +3 -3
- package/build/src/plugins/retry.js +2 -2
- package/build/src/reporters/dot.js +5 -5
- package/build/src/reporters/ndjson.js +1 -1
- package/build/src/reporters/spec.js +20 -22
- package/build/src/types.d.ts +1 -1
- package/build/tests/base_reporter.spec.d.ts +1 -0
- package/build/tests/base_reporter.spec.js +111 -0
- package/build/tests/cli_parser.spec.d.ts +1 -0
- package/build/tests/cli_parser.spec.js +265 -0
- package/build/tests/config_manager.spec.d.ts +1 -0
- package/build/tests/config_manager.spec.js +741 -0
- package/build/tests/core.spec.d.ts +1 -0
- package/build/tests/core.spec.js +31 -0
- package/build/tests/files_manager.spec.d.ts +1 -0
- package/build/tests/files_manager.spec.js +153 -0
- package/build/tests/planner.spec.d.ts +1 -0
- package/build/tests/planner.spec.js +510 -0
- package/build/tests/runner.spec.d.ts +1 -0
- package/build/tests/runner.spec.js +442 -0
- package/build/tests_helpers/main.d.ts +7 -0
- package/build/tests_helpers/main.js +34 -0
- package/package.json +10 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { dot } from '../src/reporters/main.js';
|
|
2
|
+
import { createDiverseTests, runner } from '../factories/main.js';
|
|
3
|
+
await runner()
|
|
4
|
+
.configure({
|
|
5
|
+
files: [],
|
|
6
|
+
reporters: {
|
|
7
|
+
list: [dot()],
|
|
8
|
+
activated: ['dot'],
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
.runSuites(createDiverseTests);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ndjson } from '../src/reporters/main.js';
|
|
2
|
+
import { createDiverseTests, runner } from '../factories/main.js';
|
|
3
|
+
await runner()
|
|
4
|
+
.configure({
|
|
5
|
+
files: [],
|
|
6
|
+
reporters: {
|
|
7
|
+
list: [ndjson()],
|
|
8
|
+
activated: ['ndjson'],
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
.runSuites(createDiverseTests);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { spec } from '../src/reporters/main.js';
|
|
2
|
+
import { createDiverseTests, runner } from '../factories/main.js';
|
|
3
|
+
await runner()
|
|
4
|
+
.configure({
|
|
5
|
+
files: [],
|
|
6
|
+
reporters: {
|
|
7
|
+
list: [spec()],
|
|
8
|
+
activated: ['spec'],
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
.runSuites(createDiverseTests);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Suite, Emitter, Refiner } from '../modules/core/main.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an array of suites with dummy tests reproducting
|
|
4
|
+
* different test behavior
|
|
5
|
+
*/
|
|
6
|
+
export declare function createDiverseTests(emitter: Emitter, refiner: Refiner, file?: string): Suite[];
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { Suite } from '../modules/core/main.js';
|
|
3
|
+
import { createTest, createTestGroup } from '../src/create_test.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a unit tests suite with bunch of dummy tests
|
|
6
|
+
* reproducing different tests behavior
|
|
7
|
+
*/
|
|
8
|
+
function createUnitTestsSuite(emitter, refiner, file) {
|
|
9
|
+
const suite = new Suite('unit', emitter, refiner);
|
|
10
|
+
const group = createTestGroup('Maths#add', emitter, refiner, {
|
|
11
|
+
suite,
|
|
12
|
+
file,
|
|
13
|
+
});
|
|
14
|
+
createTest('A top level test inside a suite', emitter, refiner, {
|
|
15
|
+
suite,
|
|
16
|
+
file,
|
|
17
|
+
}).run(() => { });
|
|
18
|
+
createTest('add two numbers', emitter, refiner, { group, file }).run(() => {
|
|
19
|
+
assert.equal(2 + 2, 4);
|
|
20
|
+
});
|
|
21
|
+
createTest('add three numbers', emitter, refiner, {
|
|
22
|
+
group,
|
|
23
|
+
file,
|
|
24
|
+
}).run(() => {
|
|
25
|
+
assert.equal(2 + 2 + 2, 6);
|
|
26
|
+
});
|
|
27
|
+
createTest('add group of numbers', emitter, refiner, { group, file });
|
|
28
|
+
createTest('use math.js lib', emitter, refiner, { group, file }).skip(true, 'Library work pending');
|
|
29
|
+
createTest('add multiple numbers', emitter, refiner, {
|
|
30
|
+
file,
|
|
31
|
+
group,
|
|
32
|
+
}).run(() => {
|
|
33
|
+
assert.equal(2 + 2 + 2 + 2, 6);
|
|
34
|
+
});
|
|
35
|
+
createTest('add floating numbers', emitter, refiner, { group, file })
|
|
36
|
+
.run(() => {
|
|
37
|
+
assert.equal(2 + 2.2 + 2.1, 6);
|
|
38
|
+
})
|
|
39
|
+
.fails('Have to add support for floating numbers');
|
|
40
|
+
createTest('A test with an error that is not an AssertionError', emitter, refiner, {
|
|
41
|
+
group,
|
|
42
|
+
file,
|
|
43
|
+
}).run(() => {
|
|
44
|
+
throw new Error('This is an error');
|
|
45
|
+
});
|
|
46
|
+
return suite;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a unit functional suite with bunch of dummy tests
|
|
50
|
+
* reproducing different tests behavior
|
|
51
|
+
*/
|
|
52
|
+
function createFunctionalTestsSuite(emitter, refiner, file) {
|
|
53
|
+
const suite = new Suite('functional', emitter, refiner);
|
|
54
|
+
const group = createTestGroup('Users/store', emitter, refiner, {
|
|
55
|
+
suite,
|
|
56
|
+
file: file,
|
|
57
|
+
});
|
|
58
|
+
createTest('Validate user data', emitter, refiner, {
|
|
59
|
+
group,
|
|
60
|
+
file: file,
|
|
61
|
+
}).run(() => { });
|
|
62
|
+
createTest('Disallow duplicate emails', emitter, refiner, {
|
|
63
|
+
group,
|
|
64
|
+
file: file,
|
|
65
|
+
}).run(() => { });
|
|
66
|
+
createTest('Disallow duplicate emails across tenants', emitter, refiner, {
|
|
67
|
+
group,
|
|
68
|
+
file: file,
|
|
69
|
+
}).run(() => {
|
|
70
|
+
const users = ['', ''];
|
|
71
|
+
assert.equal(users.length, 1);
|
|
72
|
+
});
|
|
73
|
+
createTest('Normalize email before persisting it', emitter, refiner, {
|
|
74
|
+
group,
|
|
75
|
+
file: file,
|
|
76
|
+
}).skip(true, 'Have to build a normalizer');
|
|
77
|
+
createTest('Send email verification mail', emitter, refiner, {
|
|
78
|
+
group,
|
|
79
|
+
file: file,
|
|
80
|
+
});
|
|
81
|
+
const usersListGroup = createTestGroup('Users/list', emitter, refiner, {
|
|
82
|
+
suite,
|
|
83
|
+
file: file,
|
|
84
|
+
});
|
|
85
|
+
usersListGroup.setup(() => {
|
|
86
|
+
throw new Error('Unable to cleanup database');
|
|
87
|
+
});
|
|
88
|
+
createTest('A test that will never because the group hooks fails', emitter, refiner, {
|
|
89
|
+
group: usersListGroup,
|
|
90
|
+
});
|
|
91
|
+
createTest('A top level test inside functional suite', emitter, refiner, {
|
|
92
|
+
suite,
|
|
93
|
+
file: file,
|
|
94
|
+
}).run(() => { });
|
|
95
|
+
return suite;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns an array of suites with dummy tests reproducting
|
|
99
|
+
* different test behavior
|
|
100
|
+
*/
|
|
101
|
+
export function createDiverseTests(emitter, refiner, file) {
|
|
102
|
+
return [
|
|
103
|
+
createUnitTestsSuite(emitter, refiner, file),
|
|
104
|
+
createFunctionalTestsSuite(emitter, refiner, file),
|
|
105
|
+
];
|
|
106
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ReporterContract } from '../src/types.js';
|
|
1
2
|
import { RunnerFactory } from './runner.js';
|
|
2
3
|
/**
|
|
3
4
|
* Create an instance of the runner factory
|
|
4
5
|
*/
|
|
5
6
|
export declare const runner: () => RunnerFactory;
|
|
7
|
+
export { createDiverseTests } from './create_diverse_tests.js';
|
|
8
|
+
export declare const syncReporter: ReporterContract;
|
package/build/factories/main.js
CHANGED
|
@@ -11,3 +11,15 @@ import { RunnerFactory } from './runner.js';
|
|
|
11
11
|
* Create an instance of the runner factory
|
|
12
12
|
*/
|
|
13
13
|
export const runner = () => new RunnerFactory();
|
|
14
|
+
export { createDiverseTests } from './create_diverse_tests.js';
|
|
15
|
+
export const syncReporter = {
|
|
16
|
+
name: 'sync',
|
|
17
|
+
handler(r, emitter) {
|
|
18
|
+
emitter.on('runner:end', function () {
|
|
19
|
+
const summary = r.getSummary();
|
|
20
|
+
if (summary.hasError) {
|
|
21
|
+
throw summary.failureTree[0].children[0].errors[0].error;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Suite, Emitter, TestContext, Refiner } from '../modules/core/main.js';
|
|
2
|
+
import type { Config, TestExecutor, RunnerSummary } from '../src/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Runner factory exposes the API to run dummy suites, groups and tests.
|
|
5
5
|
* You might want to use the factory for testing reporters and
|
|
@@ -11,17 +11,16 @@ export declare class RunnerFactory {
|
|
|
11
11
|
* Configure runner
|
|
12
12
|
*/
|
|
13
13
|
configure(config: Config, argv?: string[]): this;
|
|
14
|
-
/**
|
|
15
|
-
* Register custom suites to execute instead
|
|
16
|
-
* of the dummy one's
|
|
17
|
-
*/
|
|
18
|
-
withSuites(suites: Suite[]): this;
|
|
19
14
|
/**
|
|
20
15
|
* Define a custom emitter instance to use
|
|
21
16
|
*/
|
|
22
17
|
useEmitter(emitter: Emitter): this;
|
|
18
|
+
/**
|
|
19
|
+
* Run a test using the runner
|
|
20
|
+
*/
|
|
21
|
+
runTest(title: string, callback: TestExecutor<TestContext, undefined>): Promise<RunnerSummary>;
|
|
23
22
|
/**
|
|
24
23
|
* Run dummy tests. You might use
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
runSuites(suites: (emitter: Emitter, refiner: Refiner, file?: string) => Suite[]): Promise<RunnerSummary>;
|
|
27
26
|
}
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import assert from 'node:assert';
|
|
10
9
|
import { fileURLToPath } from 'node:url';
|
|
11
10
|
import { Planner } from '../src/planner.js';
|
|
12
11
|
import { GlobalHooks } from '../src/hooks.js';
|
|
13
12
|
import { CliParser } from '../src/cli_parser.js';
|
|
13
|
+
import { createTest } from '../src/create_test.js';
|
|
14
14
|
import { ConfigManager } from '../src/config_manager.js';
|
|
15
|
-
import { createTest, createTestGroup } from '../src/create_test.js';
|
|
16
15
|
import { Suite, Runner, Emitter } from '../modules/core/main.js';
|
|
17
16
|
/**
|
|
18
17
|
* Runner factory exposes the API to run dummy suites, groups and tests.
|
|
@@ -23,118 +22,10 @@ export class RunnerFactory {
|
|
|
23
22
|
#emitter = new Emitter();
|
|
24
23
|
#config;
|
|
25
24
|
#cliArgs;
|
|
26
|
-
#suites;
|
|
27
25
|
#file = fileURLToPath(import.meta.url);
|
|
28
26
|
get #refiner() {
|
|
29
27
|
return this.#config.refiner;
|
|
30
28
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Creating unit and functional suites
|
|
33
|
-
*/
|
|
34
|
-
#createSuites() {
|
|
35
|
-
return [
|
|
36
|
-
new Suite('unit', this.#emitter, this.#refiner),
|
|
37
|
-
new Suite('functional', this.#emitter, this.#refiner),
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Creates a variety of tests for Maths.add method
|
|
42
|
-
*/
|
|
43
|
-
#createAdditionTests(group) {
|
|
44
|
-
createTest('add two numbers', this.#emitter, this.#refiner, { group, file: this.#file }).run(() => {
|
|
45
|
-
assert.equal(2 + 2, 4);
|
|
46
|
-
});
|
|
47
|
-
createTest('add three numbers', this.#emitter, this.#refiner, {
|
|
48
|
-
group,
|
|
49
|
-
file: this.#file,
|
|
50
|
-
}).run(() => {
|
|
51
|
-
assert.equal(2 + 2 + 2, 6);
|
|
52
|
-
});
|
|
53
|
-
createTest('add group of numbers', this.#emitter, this.#refiner, { group, file: this.#file });
|
|
54
|
-
createTest('use math.js lib', this.#emitter, this.#refiner, { group, file: this.#file }).skip(true, 'Library work pending');
|
|
55
|
-
createTest('add multiple numbers', this.#emitter, this.#refiner, {
|
|
56
|
-
file: this.#file,
|
|
57
|
-
group,
|
|
58
|
-
}).run(() => {
|
|
59
|
-
assert.equal(2 + 2 + 2 + 2, 6);
|
|
60
|
-
});
|
|
61
|
-
createTest('add floating numbers', this.#emitter, this.#refiner, { group, file: this.#file })
|
|
62
|
-
.run(() => {
|
|
63
|
-
assert.equal(2 + 2.2 + 2.1, 6);
|
|
64
|
-
})
|
|
65
|
-
.fails('Have to add support for floating numbers');
|
|
66
|
-
createTest('A test with an error that is not an AssertionError', this.#emitter, this.#refiner, {
|
|
67
|
-
group,
|
|
68
|
-
file: this.#file,
|
|
69
|
-
}).run(() => {
|
|
70
|
-
throw new Error('This is an error');
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Creates a variety of dummy tests for creating
|
|
75
|
-
* a new user
|
|
76
|
-
*/
|
|
77
|
-
#createUserStoreTests(group) {
|
|
78
|
-
createTest('Validate user data', this.#emitter, this.#refiner, {
|
|
79
|
-
group,
|
|
80
|
-
file: this.#file,
|
|
81
|
-
}).run(() => { });
|
|
82
|
-
createTest('Disallow duplicate emails', this.#emitter, this.#refiner, {
|
|
83
|
-
group,
|
|
84
|
-
file: this.#file,
|
|
85
|
-
}).run(() => { });
|
|
86
|
-
createTest('Disallow duplicate emails across tenants', this.#emitter, this.#refiner, {
|
|
87
|
-
group,
|
|
88
|
-
file: this.#file,
|
|
89
|
-
}).run(() => {
|
|
90
|
-
const users = ['', ''];
|
|
91
|
-
assert.equal(users.length, 1);
|
|
92
|
-
});
|
|
93
|
-
createTest('Normalize email before persisting it', this.#emitter, this.#refiner, {
|
|
94
|
-
group,
|
|
95
|
-
file: this.#file,
|
|
96
|
-
}).skip(true, 'Have to build a normalizer');
|
|
97
|
-
createTest('Send email verification mail', this.#emitter, this.#refiner, {
|
|
98
|
-
group,
|
|
99
|
-
file: this.#file,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Creates tests for the unit tests suite
|
|
104
|
-
*/
|
|
105
|
-
#createUnitTests(suite) {
|
|
106
|
-
const additionGroup = createTestGroup('Maths#add', this.#emitter, this.#refiner, {
|
|
107
|
-
suite,
|
|
108
|
-
file: this.#file,
|
|
109
|
-
});
|
|
110
|
-
this.#createAdditionTests(additionGroup);
|
|
111
|
-
createTest('A top level test inside a suite', this.#emitter, this.#refiner, {
|
|
112
|
-
suite,
|
|
113
|
-
file: this.#file,
|
|
114
|
-
}).run(() => { });
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Creates tests for the functional tests suite
|
|
118
|
-
*/
|
|
119
|
-
#createFunctionalTests(suite) {
|
|
120
|
-
const usersStoreGroup = createTestGroup('Users/store', this.#emitter, this.#refiner, {
|
|
121
|
-
suite,
|
|
122
|
-
file: this.#file,
|
|
123
|
-
});
|
|
124
|
-
this.#createUserStoreTests(usersStoreGroup);
|
|
125
|
-
const usersListGroup = createTestGroup('Users/list', this.#emitter, this.#refiner, {
|
|
126
|
-
suite,
|
|
127
|
-
file: this.#file,
|
|
128
|
-
});
|
|
129
|
-
usersListGroup.setup(() => {
|
|
130
|
-
throw new Error('Unable to cleanup database');
|
|
131
|
-
});
|
|
132
|
-
createTest('A test that will never because the group hooks fails', this.#emitter, this.#refiner, { group: usersListGroup });
|
|
133
|
-
createTest('A top level test inside functional suite', this.#emitter, this.#refiner, {
|
|
134
|
-
suite,
|
|
135
|
-
file: this.#file,
|
|
136
|
-
}).run(() => { });
|
|
137
|
-
}
|
|
138
29
|
/**
|
|
139
30
|
* Registers plugins
|
|
140
31
|
*/
|
|
@@ -156,14 +47,6 @@ export class RunnerFactory {
|
|
|
156
47
|
this.#config = new ConfigManager(config, this.#cliArgs).hydrate();
|
|
157
48
|
return this;
|
|
158
49
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Register custom suites to execute instead
|
|
161
|
-
* of the dummy one's
|
|
162
|
-
*/
|
|
163
|
-
withSuites(suites) {
|
|
164
|
-
this.#suites = suites;
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
50
|
/**
|
|
168
51
|
* Define a custom emitter instance to use
|
|
169
52
|
*/
|
|
@@ -171,10 +54,23 @@ export class RunnerFactory {
|
|
|
171
54
|
this.#emitter = emitter;
|
|
172
55
|
return this;
|
|
173
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Run a test using the runner
|
|
59
|
+
*/
|
|
60
|
+
async runTest(title, callback) {
|
|
61
|
+
return this.runSuites((emitter, refiner, file) => {
|
|
62
|
+
const defaultSuite = new Suite('default', emitter, refiner);
|
|
63
|
+
createTest(title, emitter, refiner, {
|
|
64
|
+
suite: defaultSuite,
|
|
65
|
+
file: file,
|
|
66
|
+
}).run(callback);
|
|
67
|
+
return [defaultSuite];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
174
70
|
/**
|
|
175
71
|
* Run dummy tests. You might use
|
|
176
72
|
*/
|
|
177
|
-
async
|
|
73
|
+
async runSuites(suites) {
|
|
178
74
|
const runner = new Runner(this.#emitter);
|
|
179
75
|
await this.#registerPlugins(runner);
|
|
180
76
|
const { config, reporters, refinerFilters } = await new Planner(this.#config).plan();
|
|
@@ -186,16 +82,7 @@ export class RunnerFactory {
|
|
|
186
82
|
refinerFilters.forEach((filter) => {
|
|
187
83
|
config.refiner.add(filter.layer, filter.filters);
|
|
188
84
|
});
|
|
189
|
-
|
|
190
|
-
this.#suites.forEach((suite) => runner.add(suite));
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
const [unit, functional] = this.#createSuites();
|
|
194
|
-
this.#createUnitTests(unit);
|
|
195
|
-
runner.add(unit);
|
|
196
|
-
this.#createFunctionalTests(functional);
|
|
197
|
-
runner.add(functional);
|
|
198
|
-
}
|
|
85
|
+
suites(this.#emitter, this.#refiner, this.#file).forEach((suite) => runner.add(suite));
|
|
199
86
|
await globalHooks.setup(runner);
|
|
200
87
|
await runner.start();
|
|
201
88
|
await runner.exec();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
1
2
|
import { Emitter, Refiner, Test as BaseTest, Suite as BaseSuite, Group as BaseGroup, Runner as BaseRunner, TestContext as BaseTestContext } from '@japa/core';
|
|
2
3
|
import { BaseReporter } from './reporters/base.js';
|
|
3
4
|
import type { DataSetNode, TestHooksCleanupHandler } from './types.js';
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
9
|
import debug from './debug.js';
|
|
10
|
-
import { dot, ndjson, spec } from './reporters/main.js';
|
|
11
10
|
import { Refiner } from '../modules/core/main.js';
|
|
11
|
+
import { dot, ndjson, spec } from './reporters/main.js';
|
|
12
12
|
export const NOOP = () => { };
|
|
13
13
|
/**
|
|
14
14
|
* Defaults to use for configuration
|
package/build/src/debug.d.ts
CHANGED
package/build/src/helpers.d.ts
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
sticker: () => import("@poppinss/cliui").Instructions;
|
|
17
|
-
instructions: () => import("@poppinss/cliui").Instructions;
|
|
18
|
-
switchMode(modeToUse: "raw" | "silent" | "normal"): void;
|
|
19
|
-
useRenderer(rendererToUse: import("@poppinss/cliui/types").RendererContract): void;
|
|
20
|
-
useColors(colorsToUse: import("@poppinss/colors/types").Colors): void;
|
|
1
|
+
import { Colors } from '@poppinss/colors/types';
|
|
2
|
+
export declare const colors: Colors;
|
|
3
|
+
/**
|
|
4
|
+
* A collection of platform specific icons
|
|
5
|
+
*/
|
|
6
|
+
export declare const icons: {
|
|
7
|
+
tick: string;
|
|
8
|
+
cross: string;
|
|
9
|
+
bullet: string;
|
|
10
|
+
nodejs: string;
|
|
11
|
+
pointer: string;
|
|
12
|
+
info: string;
|
|
13
|
+
warning: string;
|
|
14
|
+
squareSmallFilled: string;
|
|
21
15
|
};
|
|
22
|
-
export default _default;
|
package/build/src/helpers.js
CHANGED
|
@@ -6,5 +6,29 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
10
|
-
export
|
|
9
|
+
import useColors from '@poppinss/colors';
|
|
10
|
+
export const colors = useColors.ansi();
|
|
11
|
+
/**
|
|
12
|
+
* A collection of platform specific icons
|
|
13
|
+
*/
|
|
14
|
+
export const icons = process.platform === 'win32' && !process.env.WT_SESSION
|
|
15
|
+
? {
|
|
16
|
+
tick: '√',
|
|
17
|
+
cross: '×',
|
|
18
|
+
bullet: '*',
|
|
19
|
+
nodejs: '♦',
|
|
20
|
+
pointer: '>',
|
|
21
|
+
info: 'i',
|
|
22
|
+
warning: '‼',
|
|
23
|
+
squareSmallFilled: '[█]',
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
tick: '✔',
|
|
27
|
+
cross: '✖',
|
|
28
|
+
bullet: '●',
|
|
29
|
+
nodejs: '⬢',
|
|
30
|
+
pointer: '❯',
|
|
31
|
+
info: 'ℹ',
|
|
32
|
+
warning: '⚠',
|
|
33
|
+
squareSmallFilled: '◼',
|
|
34
|
+
};
|
package/build/src/planner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
import type { NormalizedConfig, TestSuite } from './types.js';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { NamedReporterContract, NormalizedConfig, TestSuite } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The tests planner is used to plan the tests by doing all
|
|
5
5
|
* the heavy lifting of executing plugins, registering
|
|
@@ -12,7 +12,7 @@ export declare class Planner {
|
|
|
12
12
|
* Creates a plan for running the tests
|
|
13
13
|
*/
|
|
14
14
|
plan(): Promise<{
|
|
15
|
-
reporters:
|
|
15
|
+
reporters: NamedReporterContract[];
|
|
16
16
|
suites: (TestSuite & {
|
|
17
17
|
filesURLs: URL[];
|
|
18
18
|
})[];
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import findCacheDirectory from 'find-cache-dir';
|
|
11
11
|
import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';
|
|
12
|
-
import
|
|
12
|
+
import { colors } from '../helpers.js';
|
|
13
13
|
/**
|
|
14
14
|
* Paths to the cache directory and the summary file
|
|
15
15
|
*/
|
|
@@ -58,7 +58,7 @@ export const retryPlugin = async function retry({ config, cliArgs }) {
|
|
|
58
58
|
if (cliArgs.failed) {
|
|
59
59
|
const { tests } = await getFailedTests();
|
|
60
60
|
if (!tests || !tests.length) {
|
|
61
|
-
console.log(
|
|
61
|
+
console.log(colors.bgYellow().black(' No failing tests found. Running all the tests '));
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
config.filters.tests = tests;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
9
|
+
import { colors, icons } from '../helpers.js';
|
|
10
10
|
import { BaseReporter } from '../../modules/core/reporters/base.js';
|
|
11
11
|
/**
|
|
12
12
|
* Minimal reporter that prints each test as an icon.
|
|
@@ -18,16 +18,16 @@ export class DotReporter extends BaseReporter {
|
|
|
18
18
|
onTestEnd(payload) {
|
|
19
19
|
let output = '';
|
|
20
20
|
if (payload.isTodo) {
|
|
21
|
-
output =
|
|
21
|
+
output = colors.cyan(icons.info);
|
|
22
22
|
}
|
|
23
23
|
else if (payload.hasError || payload.isFailing) {
|
|
24
|
-
output =
|
|
24
|
+
output = payload.hasError ? colors.magenta(icons.squareSmallFilled) : colors.red(icons.cross);
|
|
25
25
|
}
|
|
26
26
|
else if (payload.isSkipped) {
|
|
27
|
-
output =
|
|
27
|
+
output = colors.yellow(icons.bullet);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
output =
|
|
30
|
+
output = colors.green(icons.tick);
|
|
31
31
|
}
|
|
32
32
|
process.stdout.write(`${output}`);
|
|
33
33
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
9
|
import { relative } from 'node:path';
|
|
10
|
-
import { BaseReporter } from '../../modules/core/main.js';
|
|
11
10
|
import { serializeError } from 'serialize-error';
|
|
11
|
+
import { BaseReporter } from '../../modules/core/main.js';
|
|
12
12
|
/**
|
|
13
13
|
* Prints tests progress as JSON. Each event is emitted
|
|
14
14
|
* independently
|