1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | class FailedTestsCache {
|
15 | _enabledTestsMap;
|
16 | filterTests(tests) {
|
17 | const enabledTestsMap = this._enabledTestsMap;
|
18 | if (!enabledTestsMap) {
|
19 | return tests;
|
20 | }
|
21 | return tests.filter(testResult => enabledTestsMap[testResult.path]);
|
22 | }
|
23 | setTestResults(testResults) {
|
24 | this._enabledTestsMap = (testResults || []).reduce(
|
25 | (suiteMap, testResult) => {
|
26 | if (!testResult.numFailingTests) {
|
27 | return suiteMap;
|
28 | }
|
29 | suiteMap[testResult.testFilePath] = testResult.testResults.reduce(
|
30 | (testMap, test) => {
|
31 | if (test.status !== 'failed') {
|
32 | return testMap;
|
33 | }
|
34 | testMap[test.fullName] = true;
|
35 | return testMap;
|
36 | },
|
37 | {}
|
38 | );
|
39 | return suiteMap;
|
40 | },
|
41 | {}
|
42 | );
|
43 | this._enabledTestsMap = Object.freeze(this._enabledTestsMap);
|
44 | }
|
45 | }
|
46 | exports.default = FailedTestsCache;
|