@teambit/tester 1.0.959 → 1.0.960
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/dist/{preview-1776776950183.js → preview-1776783730786.js} +2 -2
- package/dist/test-output-formatter.d.ts +36 -0
- package/dist/test-output-formatter.js +168 -0
- package/dist/test-output-formatter.js.map +1 -0
- package/dist/test-output-formatter.spec.d.ts +1 -0
- package/dist/test-output-formatter.spec.js +312 -0
- package/dist/test-output-formatter.spec.js.map +1 -0
- package/dist/test.cmd.d.ts +4 -2
- package/dist/test.cmd.js +93 -30
- package/dist/test.cmd.js.map +1 -1
- package/dist/tester.service.js +7 -8
- package/dist/tester.service.js.map +1 -1
- package/package.json +16 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_tester@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_tester@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_tester@1.0.960/dist/tester.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_tester@1.0.960/dist/tester.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Component, ComponentID } from '@teambit/component';
|
|
2
|
+
import type { TestResults } from './tester.main.runtime';
|
|
3
|
+
export type ComponentTestSummary = {
|
|
4
|
+
id: ComponentID;
|
|
5
|
+
passed: number;
|
|
6
|
+
failed: number;
|
|
7
|
+
pending: number;
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type EnvTestError = {
|
|
11
|
+
envId?: string;
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
export type TestOutputSummary = {
|
|
15
|
+
componentsWithTests: ComponentTestSummary[];
|
|
16
|
+
componentsWithoutTests: ComponentID[];
|
|
17
|
+
/** components that belong to an env whose tester errored before producing results */
|
|
18
|
+
componentsAffectedByEnvError: ComponentID[];
|
|
19
|
+
envErrors: EnvTestError[];
|
|
20
|
+
totals: {
|
|
21
|
+
totalComponents: number;
|
|
22
|
+
tested: number;
|
|
23
|
+
withoutTests: number;
|
|
24
|
+
affectedByEnvError: number;
|
|
25
|
+
testsPassed: number;
|
|
26
|
+
testsFailed: number;
|
|
27
|
+
testsPending: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function aggregateTestResults(results: TestResults, allComponents: Component[]): TestOutputSummary;
|
|
31
|
+
export declare function formatTestReport(summary: TestOutputSummary, opts: {
|
|
32
|
+
verbose: boolean;
|
|
33
|
+
duration: string;
|
|
34
|
+
summaryOnly?: boolean;
|
|
35
|
+
failedDueToExitCode?: boolean;
|
|
36
|
+
}): string;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.aggregateTestResults = aggregateTestResults;
|
|
7
|
+
exports.formatTestReport = formatTestReport;
|
|
8
|
+
function _lodash() {
|
|
9
|
+
const data = require("lodash");
|
|
10
|
+
_lodash = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _cli() {
|
|
16
|
+
const data = require("@teambit/cli");
|
|
17
|
+
_cli = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function aggregateTestResults(results, allComponents) {
|
|
23
|
+
const componentsWithTests = [];
|
|
24
|
+
const envErrors = [];
|
|
25
|
+
const testedIds = new Set();
|
|
26
|
+
const affectedByEnvErrorIds = new Set();
|
|
27
|
+
// normalize on both sides so a version-mismatch between the tester's ComponentsResults and the
|
|
28
|
+
// workspace `allComponents` list can't leak a tested component into `componentsWithoutTests`.
|
|
29
|
+
const idKey = id => id.toString({
|
|
30
|
+
ignoreVersion: true
|
|
31
|
+
});
|
|
32
|
+
for (const envResult of results.results) {
|
|
33
|
+
const envId = envResult.env?.id;
|
|
34
|
+
const envComponents = envResult.env?.components ?? [];
|
|
35
|
+
if (envResult.error) {
|
|
36
|
+
envErrors.push({
|
|
37
|
+
envId,
|
|
38
|
+
error: envResult.error
|
|
39
|
+
});
|
|
40
|
+
envComponents.forEach(c => affectedByEnvErrorIds.add(idKey(c.id)));
|
|
41
|
+
}
|
|
42
|
+
const tests = envResult.data;
|
|
43
|
+
if (!tests) continue;
|
|
44
|
+
for (const comp of tests.components) {
|
|
45
|
+
const summary = summarizeComponent(comp);
|
|
46
|
+
if (!summary) continue;
|
|
47
|
+
testedIds.add(idKey(comp.componentId));
|
|
48
|
+
componentsWithTests.push(summary);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const componentsAffectedByEnvError = [];
|
|
52
|
+
const componentsWithoutTests = [];
|
|
53
|
+
for (const c of allComponents) {
|
|
54
|
+
const key = idKey(c.id);
|
|
55
|
+
if (testedIds.has(key)) continue;
|
|
56
|
+
if (affectedByEnvErrorIds.has(key)) componentsAffectedByEnvError.push(c.id);else componentsWithoutTests.push(c.id);
|
|
57
|
+
}
|
|
58
|
+
const totals = {
|
|
59
|
+
totalComponents: allComponents.length,
|
|
60
|
+
tested: componentsWithTests.length,
|
|
61
|
+
withoutTests: componentsWithoutTests.length,
|
|
62
|
+
affectedByEnvError: componentsAffectedByEnvError.length,
|
|
63
|
+
testsPassed: (0, _lodash().sumBy)(componentsWithTests, c => c.passed),
|
|
64
|
+
testsFailed: (0, _lodash().sumBy)(componentsWithTests, c => c.failed),
|
|
65
|
+
testsPending: (0, _lodash().sumBy)(componentsWithTests, c => c.pending)
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
componentsWithTests,
|
|
69
|
+
componentsWithoutTests,
|
|
70
|
+
componentsAffectedByEnvError,
|
|
71
|
+
envErrors,
|
|
72
|
+
totals
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function summarizeComponent(comp) {
|
|
76
|
+
const testFiles = comp.results?.testFiles ?? [];
|
|
77
|
+
if (!testFiles.length && !comp.errors?.length) return undefined;
|
|
78
|
+
const passed = (0, _lodash().sumBy)(testFiles, f => f.pass || 0);
|
|
79
|
+
const failed = (0, _lodash().sumBy)(testFiles, f => f.failed || 0);
|
|
80
|
+
const pending = (0, _lodash().sumBy)(testFiles, f => f.pending || 0);
|
|
81
|
+
const hasError = Boolean(comp.errors?.length) || testFiles.some(f => f.error);
|
|
82
|
+
return {
|
|
83
|
+
id: comp.componentId,
|
|
84
|
+
passed,
|
|
85
|
+
failed,
|
|
86
|
+
pending,
|
|
87
|
+
hasError
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function formatTestReport(summary, opts) {
|
|
91
|
+
const {
|
|
92
|
+
componentsWithTests,
|
|
93
|
+
componentsWithoutTests,
|
|
94
|
+
envErrors,
|
|
95
|
+
totals
|
|
96
|
+
} = summary;
|
|
97
|
+
const componentsWithFailedTests = componentsWithTests.filter(c => c.failed > 0).length;
|
|
98
|
+
const componentsWithOnlyTesterErrors = componentsWithTests.filter(c => c.failed === 0 && c.hasError).length;
|
|
99
|
+
const finalSummary = formatFinalSummary(totals, componentsWithFailedTests, componentsWithOnlyTesterErrors, envErrors.length > 0, opts.duration, opts.failedDueToExitCode ?? false);
|
|
100
|
+
if (opts.summaryOnly) return finalSummary;
|
|
101
|
+
const perComponentLines = componentsWithTests.sort((a, b) => a.id.toString().localeCompare(b.id.toString())).map(formatComponentLine);
|
|
102
|
+
const resultsSection = perComponentLines.length ? [(0, _cli().formatTitle)('test results'), ...perComponentLines].join('\n') : '';
|
|
103
|
+
const envErrorsSection = envErrors.length ? [`${_cli().errorSymbol} ${(0, _cli().formatTitle)('tester errors')}`, ...envErrors.map(e => ` ${_cli().errorSymbol} ${e.envId ?? 'unknown env'}: ${e.error.message}`)].join('\n') : '';
|
|
104
|
+
const noTestsSection = formatNoTestsSection(componentsWithoutTests, opts.verbose);
|
|
105
|
+
return (0, _cli().joinSections)([resultsSection, envErrorsSection, noTestsSection, finalSummary]);
|
|
106
|
+
}
|
|
107
|
+
function formatComponentLine(c) {
|
|
108
|
+
const id = c.id.toString({
|
|
109
|
+
ignoreVersion: true
|
|
110
|
+
});
|
|
111
|
+
const parts = [];
|
|
112
|
+
if (c.failed > 0) parts.push(`${c.failed} failed`);
|
|
113
|
+
if (c.passed > 0) parts.push(`${c.passed} passed`);
|
|
114
|
+
if (c.pending > 0) parts.push(`${c.pending} pending`);
|
|
115
|
+
const stats = parts.length ? parts.join(', ') : 'no test counts reported';
|
|
116
|
+
const text = `${id} — ${stats}`;
|
|
117
|
+
if (c.failed > 0) return (0, _cli().formatItem)(text, _cli().errorSymbol);
|
|
118
|
+
if (c.hasError) return (0, _cli().formatItem)(`${text} (tester reported errors)`, _cli().warnSymbol);
|
|
119
|
+
return (0, _cli().formatItem)(text, (0, _cli().successSymbol)());
|
|
120
|
+
}
|
|
121
|
+
function formatNoTestsSection(ids, verbose) {
|
|
122
|
+
if (!ids.length) return '';
|
|
123
|
+
if (!verbose) {
|
|
124
|
+
return (0, _cli().formatHint)(`${ids.length} components have no tests (run with --verbose to list)`);
|
|
125
|
+
}
|
|
126
|
+
const lines = ids.map(id => id.toString({
|
|
127
|
+
ignoreVersion: true
|
|
128
|
+
})).sort().map(s => (0, _cli().formatItem)(s));
|
|
129
|
+
return [(0, _cli().formatHint)(`${ids.length} components have no tests`), ...lines].join('\n');
|
|
130
|
+
}
|
|
131
|
+
function formatFinalSummary(totals, componentsWithFailedTests, componentsWithOnlyTesterErrors, hasEnvError, duration, failedDueToExitCode) {
|
|
132
|
+
const totalTests = totals.testsPassed + totals.testsFailed + totals.testsPending;
|
|
133
|
+
const suffixParts = [];
|
|
134
|
+
if (totals.withoutTests > 0) suffixParts.push(`${totals.withoutTests} without tests`);
|
|
135
|
+
if (totals.affectedByEnvError > 0) suffixParts.push(`${totals.affectedByEnvError} not tested due to tester errors`);
|
|
136
|
+
const extraSuffix = suffixParts.length ? `, ${suffixParts.join(', ')}` : '';
|
|
137
|
+
const pendingSuffix = totals.testsPending > 0 ? `, ${totals.testsPending} pending` : '';
|
|
138
|
+
const timing = (0, _cli().formatHint)(`Finished. (${duration})`);
|
|
139
|
+
const anyFailing = componentsWithFailedTests + componentsWithOnlyTesterErrors;
|
|
140
|
+
if (hasEnvError || totals.testsFailed > 0 || anyFailing > 0) {
|
|
141
|
+
const attempted = totals.tested + totals.affectedByEnvError;
|
|
142
|
+
let headline;
|
|
143
|
+
if (totals.testsFailed > 0) {
|
|
144
|
+
const testerErrorSuffix = componentsWithOnlyTesterErrors > 0 ? ` (+${componentsWithOnlyTesterErrors} components had tester errors)` : '';
|
|
145
|
+
headline = `${totals.testsFailed} tests failed across ${componentsWithFailedTests} of ${totals.tested} components${testerErrorSuffix}${pendingSuffix}${extraSuffix}`;
|
|
146
|
+
} else if (totals.testsPassed > 0) {
|
|
147
|
+
// tests passed but some components had tester-level errors — surface both
|
|
148
|
+
const passedComponents = totals.tested - componentsWithOnlyTesterErrors;
|
|
149
|
+
headline = `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${passedComponents} components, but ${componentsWithOnlyTesterErrors} components had tester errors${pendingSuffix}${extraSuffix}`;
|
|
150
|
+
} else {
|
|
151
|
+
headline = `tester errors encountered (${attempted || totals.totalComponents} components targeted${extraSuffix})`;
|
|
152
|
+
}
|
|
153
|
+
return `${(0, _cli().formatWarningSummary)(headline)}\n${timing}`;
|
|
154
|
+
}
|
|
155
|
+
if (failedDueToExitCode) {
|
|
156
|
+
const passedPart = totals.tested > 0 ? `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${totals.tested} components${pendingSuffix}${extraSuffix}` : `no test failures reported${extraSuffix}`;
|
|
157
|
+
const headline = `${passedPart}, but tester exited with a non-zero code (e.g. coverage threshold not met)`;
|
|
158
|
+
return `${(0, _cli().formatWarningSummary)(headline)}\n${timing}`;
|
|
159
|
+
}
|
|
160
|
+
if (totals.tested === 0) {
|
|
161
|
+
const none = totals.totalComponents === 0 ? 'no components to test' : `no tests found (${totals.totalComponents} components, none with tests)`;
|
|
162
|
+
return `${(0, _cli().formatHint)(none)}\n${timing}`;
|
|
163
|
+
}
|
|
164
|
+
const headline = `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${totals.tested} components${pendingSuffix}${extraSuffix}`;
|
|
165
|
+
return `${(0, _cli().formatSuccessSummary)(headline)}\n${timing}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=test-output-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_cli","aggregateTestResults","results","allComponents","componentsWithTests","envErrors","testedIds","Set","affectedByEnvErrorIds","idKey","id","toString","ignoreVersion","envResult","envId","env","envComponents","components","error","push","forEach","c","add","tests","comp","summary","summarizeComponent","componentId","componentsAffectedByEnvError","componentsWithoutTests","key","has","totals","totalComponents","length","tested","withoutTests","affectedByEnvError","testsPassed","sumBy","passed","testsFailed","failed","testsPending","pending","testFiles","errors","undefined","f","pass","hasError","Boolean","some","formatTestReport","opts","componentsWithFailedTests","filter","componentsWithOnlyTesterErrors","finalSummary","formatFinalSummary","duration","failedDueToExitCode","summaryOnly","perComponentLines","sort","a","b","localeCompare","map","formatComponentLine","resultsSection","formatTitle","join","envErrorsSection","errorSymbol","e","message","noTestsSection","formatNoTestsSection","verbose","joinSections","parts","stats","text","formatItem","warnSymbol","successSymbol","ids","formatHint","lines","s","hasEnvError","totalTests","suffixParts","extraSuffix","pendingSuffix","timing","anyFailing","attempted","headline","testerErrorSuffix","passedComponents","formatWarningSummary","passedPart","none","formatSuccessSummary"],"sources":["test-output-formatter.ts"],"sourcesContent":["import { sumBy } from 'lodash';\nimport type { Component, ComponentID } from '@teambit/component';\nimport {\n formatTitle,\n formatHint,\n formatItem,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n successSymbol,\n errorSymbol,\n warnSymbol,\n} from '@teambit/cli';\nimport type { TestResults } from './tester.main.runtime';\n\nexport type ComponentTestSummary = {\n id: ComponentID;\n passed: number;\n failed: number;\n pending: number;\n hasError: boolean;\n};\n\nexport type EnvTestError = {\n envId?: string;\n error: Error;\n};\n\nexport type TestOutputSummary = {\n componentsWithTests: ComponentTestSummary[];\n componentsWithoutTests: ComponentID[];\n /** components that belong to an env whose tester errored before producing results */\n componentsAffectedByEnvError: ComponentID[];\n envErrors: EnvTestError[];\n totals: {\n totalComponents: number;\n tested: number;\n withoutTests: number;\n affectedByEnvError: number;\n testsPassed: number;\n testsFailed: number;\n testsPending: number;\n };\n};\n\nexport function aggregateTestResults(results: TestResults, allComponents: Component[]): TestOutputSummary {\n const componentsWithTests: ComponentTestSummary[] = [];\n const envErrors: EnvTestError[] = [];\n const testedIds = new Set<string>();\n const affectedByEnvErrorIds = new Set<string>();\n // normalize on both sides so a version-mismatch between the tester's ComponentsResults and the\n // workspace `allComponents` list can't leak a tested component into `componentsWithoutTests`.\n const idKey = (id: ComponentID) => id.toString({ ignoreVersion: true });\n\n for (const envResult of results.results) {\n const envId = envResult.env?.id;\n const envComponents: Component[] = envResult.env?.components ?? [];\n if (envResult.error) {\n envErrors.push({ envId, error: envResult.error });\n envComponents.forEach((c) => affectedByEnvErrorIds.add(idKey(c.id)));\n }\n const tests = envResult.data;\n if (!tests) continue;\n for (const comp of tests.components) {\n const summary = summarizeComponent(comp);\n if (!summary) continue;\n testedIds.add(idKey(comp.componentId));\n componentsWithTests.push(summary);\n }\n }\n\n const componentsAffectedByEnvError: ComponentID[] = [];\n const componentsWithoutTests: ComponentID[] = [];\n for (const c of allComponents) {\n const key = idKey(c.id);\n if (testedIds.has(key)) continue;\n if (affectedByEnvErrorIds.has(key)) componentsAffectedByEnvError.push(c.id);\n else componentsWithoutTests.push(c.id);\n }\n\n const totals = {\n totalComponents: allComponents.length,\n tested: componentsWithTests.length,\n withoutTests: componentsWithoutTests.length,\n affectedByEnvError: componentsAffectedByEnvError.length,\n testsPassed: sumBy(componentsWithTests, (c) => c.passed),\n testsFailed: sumBy(componentsWithTests, (c) => c.failed),\n testsPending: sumBy(componentsWithTests, (c) => c.pending),\n };\n\n return { componentsWithTests, componentsWithoutTests, componentsAffectedByEnvError, envErrors, totals };\n}\n\nfunction summarizeComponent(comp: {\n componentId: ComponentID;\n results?: { testFiles: Array<{ pass: number; failed: number; pending: number; error?: Error }> };\n errors?: Error[];\n}): ComponentTestSummary | undefined {\n const testFiles = comp.results?.testFiles ?? [];\n if (!testFiles.length && !comp.errors?.length) return undefined;\n const passed = sumBy(testFiles, (f) => f.pass || 0);\n const failed = sumBy(testFiles, (f) => f.failed || 0);\n const pending = sumBy(testFiles, (f) => f.pending || 0);\n const hasError = Boolean(comp.errors?.length) || testFiles.some((f) => f.error);\n return { id: comp.componentId, passed, failed, pending, hasError };\n}\n\nexport function formatTestReport(\n summary: TestOutputSummary,\n opts: { verbose: boolean; duration: string; summaryOnly?: boolean; failedDueToExitCode?: boolean }\n): string {\n const { componentsWithTests, componentsWithoutTests, envErrors, totals } = summary;\n const componentsWithFailedTests = componentsWithTests.filter((c) => c.failed > 0).length;\n const componentsWithOnlyTesterErrors = componentsWithTests.filter((c) => c.failed === 0 && c.hasError).length;\n const finalSummary = formatFinalSummary(\n totals,\n componentsWithFailedTests,\n componentsWithOnlyTesterErrors,\n envErrors.length > 0,\n opts.duration,\n opts.failedDueToExitCode ?? false\n );\n\n if (opts.summaryOnly) return finalSummary;\n\n const perComponentLines = componentsWithTests\n .sort((a, b) => a.id.toString().localeCompare(b.id.toString()))\n .map(formatComponentLine);\n\n const resultsSection = perComponentLines.length ? [formatTitle('test results'), ...perComponentLines].join('\\n') : '';\n\n const envErrorsSection = envErrors.length\n ? [\n `${errorSymbol} ${formatTitle('tester errors')}`,\n ...envErrors.map((e) => ` ${errorSymbol} ${e.envId ?? 'unknown env'}: ${e.error.message}`),\n ].join('\\n')\n : '';\n\n const noTestsSection = formatNoTestsSection(componentsWithoutTests, opts.verbose);\n\n return joinSections([resultsSection, envErrorsSection, noTestsSection, finalSummary]);\n}\n\nfunction formatComponentLine(c: ComponentTestSummary): string {\n const id = c.id.toString({ ignoreVersion: true });\n const parts: string[] = [];\n if (c.failed > 0) parts.push(`${c.failed} failed`);\n if (c.passed > 0) parts.push(`${c.passed} passed`);\n if (c.pending > 0) parts.push(`${c.pending} pending`);\n const stats = parts.length ? parts.join(', ') : 'no test counts reported';\n const text = `${id} — ${stats}`;\n\n if (c.failed > 0) return formatItem(text, errorSymbol);\n if (c.hasError) return formatItem(`${text} (tester reported errors)`, warnSymbol);\n return formatItem(text, successSymbol());\n}\n\nfunction formatNoTestsSection(ids: ComponentID[], verbose: boolean): string {\n if (!ids.length) return '';\n if (!verbose) {\n return formatHint(`${ids.length} components have no tests (run with --verbose to list)`);\n }\n const lines = ids\n .map((id) => id.toString({ ignoreVersion: true }))\n .sort()\n .map((s) => formatItem(s));\n return [formatHint(`${ids.length} components have no tests`), ...lines].join('\\n');\n}\n\nfunction formatFinalSummary(\n totals: TestOutputSummary['totals'],\n componentsWithFailedTests: number,\n componentsWithOnlyTesterErrors: number,\n hasEnvError: boolean,\n duration: string,\n failedDueToExitCode: boolean\n): string {\n const totalTests = totals.testsPassed + totals.testsFailed + totals.testsPending;\n const suffixParts: string[] = [];\n if (totals.withoutTests > 0) suffixParts.push(`${totals.withoutTests} without tests`);\n if (totals.affectedByEnvError > 0) suffixParts.push(`${totals.affectedByEnvError} not tested due to tester errors`);\n const extraSuffix = suffixParts.length ? `, ${suffixParts.join(', ')}` : '';\n const pendingSuffix = totals.testsPending > 0 ? `, ${totals.testsPending} pending` : '';\n const timing = formatHint(`Finished. (${duration})`);\n const anyFailing = componentsWithFailedTests + componentsWithOnlyTesterErrors;\n\n if (hasEnvError || totals.testsFailed > 0 || anyFailing > 0) {\n const attempted = totals.tested + totals.affectedByEnvError;\n let headline: string;\n if (totals.testsFailed > 0) {\n const testerErrorSuffix =\n componentsWithOnlyTesterErrors > 0 ? ` (+${componentsWithOnlyTesterErrors} components had tester errors)` : '';\n headline = `${totals.testsFailed} tests failed across ${componentsWithFailedTests} of ${totals.tested} components${testerErrorSuffix}${pendingSuffix}${extraSuffix}`;\n } else if (totals.testsPassed > 0) {\n // tests passed but some components had tester-level errors — surface both\n const passedComponents = totals.tested - componentsWithOnlyTesterErrors;\n headline = `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${passedComponents} components, but ${componentsWithOnlyTesterErrors} components had tester errors${pendingSuffix}${extraSuffix}`;\n } else {\n headline = `tester errors encountered (${attempted || totals.totalComponents} components targeted${extraSuffix})`;\n }\n return `${formatWarningSummary(headline)}\\n${timing}`;\n }\n\n if (failedDueToExitCode) {\n const passedPart =\n totals.tested > 0\n ? `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${totals.tested} components${pendingSuffix}${extraSuffix}`\n : `no test failures reported${extraSuffix}`;\n const headline = `${passedPart}, but tester exited with a non-zero code (e.g. coverage threshold not met)`;\n return `${formatWarningSummary(headline)}\\n${timing}`;\n }\n\n if (totals.tested === 0) {\n const none =\n totals.totalComponents === 0\n ? 'no components to test'\n : `no tests found (${totals.totalComponents} components, none with tests)`;\n return `${formatHint(none)}\\n${timing}`;\n }\n\n const headline = `${totals.testsPassed}/${totalTests || totals.testsPassed} tests passed across ${totals.tested} components${pendingSuffix}${extraSuffix}`;\n return `${formatSuccessSummary(headline)}\\n${timing}`;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,KAAA;EAAA,MAAAF,I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A+B;IAC9E,OAAO,GAAG,IAAAuD,iBAAU,EAACgB,IAAI,CAAC,KAAKR,MAAM,EAAE;EACzC;EAEA,MAAMG,QAAQ,GAAG,GAAGnE,MAAM,CAACM,WAAW,IAAIsD,UAAU,IAAI5D,MAAM,CAACM,WAAW,wBAAwBN,MAAM,CAACG,MAAM,cAAc4D,aAAa,GAAGD,WAAW,EAAE;EAC1J,OAAO,GAAG,IAAAW,2BAAoB,EAACN,QAAQ,CAAC,KAAKH,MAAM,EAAE;AACvD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _component() {
|
|
11
|
+
const data = require("@teambit/component");
|
|
12
|
+
_component = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _testsResults() {
|
|
18
|
+
const data = require("@teambit/tests-results");
|
|
19
|
+
_testsResults = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _testOutputFormatter() {
|
|
25
|
+
const data = require("./test-output-formatter");
|
|
26
|
+
_testOutputFormatter = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _tester() {
|
|
32
|
+
const data = require("./tester");
|
|
33
|
+
_tester = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
function mkId(name) {
|
|
39
|
+
return _component().ComponentID.fromString(`my-scope/${name}`);
|
|
40
|
+
}
|
|
41
|
+
function mkComponent(name) {
|
|
42
|
+
return {
|
|
43
|
+
id: mkId(name)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mkFile(pass, failed, pending = 0, error) {
|
|
47
|
+
return new (_testsResults().TestsFiles)('file.spec.ts', [], pass, failed, pending, 0, false, error);
|
|
48
|
+
}
|
|
49
|
+
function mkResults(envId, components) {
|
|
50
|
+
const compResults = components.map(({
|
|
51
|
+
name,
|
|
52
|
+
files,
|
|
53
|
+
errors
|
|
54
|
+
}) => ({
|
|
55
|
+
componentId: mkId(name),
|
|
56
|
+
results: new (_testsResults().TestsResult)(files, files.every(f => f.failed === 0 && !f.error), 0),
|
|
57
|
+
errors
|
|
58
|
+
}));
|
|
59
|
+
const hasFailure = compResults.some(c => (c.errors?.length || 0) > 0 || c.results.testFiles.some(f => f.failed > 0 || f.error));
|
|
60
|
+
const envComponents = components.map(c => mkComponent(c.name));
|
|
61
|
+
return {
|
|
62
|
+
results: [{
|
|
63
|
+
env: {
|
|
64
|
+
id: envId,
|
|
65
|
+
components: envComponents
|
|
66
|
+
},
|
|
67
|
+
data: new (_tester().Tests)(compResults)
|
|
68
|
+
}],
|
|
69
|
+
hasErrors: () => hasFailure,
|
|
70
|
+
errors: []
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
describe('aggregateTestResults()', () => {
|
|
74
|
+
it('counts passed/failed/pending across components', () => {
|
|
75
|
+
const results = mkResults('teambit.react/react', [{
|
|
76
|
+
name: 'comp-a',
|
|
77
|
+
files: [mkFile(5, 0, 1)]
|
|
78
|
+
}, {
|
|
79
|
+
name: 'comp-b',
|
|
80
|
+
files: [mkFile(2, 1, 0)]
|
|
81
|
+
}]);
|
|
82
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b')]);
|
|
83
|
+
(0, _chai().expect)(summary.totals.testsPassed).to.equal(7);
|
|
84
|
+
(0, _chai().expect)(summary.totals.testsFailed).to.equal(1);
|
|
85
|
+
(0, _chai().expect)(summary.totals.testsPending).to.equal(1);
|
|
86
|
+
(0, _chai().expect)(summary.totals.tested).to.equal(2);
|
|
87
|
+
(0, _chai().expect)(summary.totals.withoutTests).to.equal(0);
|
|
88
|
+
});
|
|
89
|
+
it('identifies components without tests', () => {
|
|
90
|
+
const results = mkResults('teambit.react/react', [{
|
|
91
|
+
name: 'comp-a',
|
|
92
|
+
files: [mkFile(3, 0)]
|
|
93
|
+
}]);
|
|
94
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b'), mkComponent('comp-c')]);
|
|
95
|
+
(0, _chai().expect)(summary.totals.withoutTests).to.equal(2);
|
|
96
|
+
(0, _chai().expect)(summary.componentsWithoutTests.map(id => id.toString())).to.include('my-scope/comp-b');
|
|
97
|
+
(0, _chai().expect)(summary.componentsWithoutTests.map(id => id.toString())).to.include('my-scope/comp-c');
|
|
98
|
+
});
|
|
99
|
+
it('surfaces env-level errors and keeps affected components out of the no-tests bucket', () => {
|
|
100
|
+
const err = new Error('tester crashed');
|
|
101
|
+
const compA = mkComponent('comp-a');
|
|
102
|
+
const results = {
|
|
103
|
+
results: [{
|
|
104
|
+
env: {
|
|
105
|
+
id: 'teambit.react/react',
|
|
106
|
+
components: [compA]
|
|
107
|
+
},
|
|
108
|
+
data: undefined,
|
|
109
|
+
error: err
|
|
110
|
+
}]
|
|
111
|
+
};
|
|
112
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [compA]);
|
|
113
|
+
(0, _chai().expect)(summary.envErrors).to.have.lengthOf(1);
|
|
114
|
+
(0, _chai().expect)(summary.envErrors[0].error.message).to.equal('tester crashed');
|
|
115
|
+
(0, _chai().expect)(summary.totals.withoutTests).to.equal(0);
|
|
116
|
+
(0, _chai().expect)(summary.totals.affectedByEnvError).to.equal(1);
|
|
117
|
+
(0, _chai().expect)(summary.componentsAffectedByEnvError.map(id => id.toString())).to.include('my-scope/comp-a');
|
|
118
|
+
});
|
|
119
|
+
it('flags components with tester errors on test files', () => {
|
|
120
|
+
const err = new Error('parse error');
|
|
121
|
+
const results = mkResults('teambit.react/react', [{
|
|
122
|
+
name: 'comp-a',
|
|
123
|
+
files: [mkFile(0, 0, 0, err)]
|
|
124
|
+
}]);
|
|
125
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a')]);
|
|
126
|
+
(0, _chai().expect)(summary.componentsWithTests[0].hasError).to.equal(true);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
describe('formatTestReport()', () => {
|
|
130
|
+
it('renders a green success summary when all pass', () => {
|
|
131
|
+
const results = mkResults('teambit.react/react', [{
|
|
132
|
+
name: 'comp-a',
|
|
133
|
+
files: [mkFile(5, 0)]
|
|
134
|
+
}]);
|
|
135
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a')]);
|
|
136
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
137
|
+
verbose: false,
|
|
138
|
+
duration: '1.2s'
|
|
139
|
+
});
|
|
140
|
+
(0, _chai().expect)(out).to.include('test results');
|
|
141
|
+
(0, _chai().expect)(out).to.include('my-scope/comp-a');
|
|
142
|
+
(0, _chai().expect)(out).to.include('5 passed');
|
|
143
|
+
(0, _chai().expect)(out).to.include('5/5 tests passed');
|
|
144
|
+
(0, _chai().expect)(out).to.include('Finished. (1.2s)');
|
|
145
|
+
});
|
|
146
|
+
it('renders warning summary with failure count when any fail', () => {
|
|
147
|
+
const results = mkResults('teambit.react/react', [{
|
|
148
|
+
name: 'comp-a',
|
|
149
|
+
files: [mkFile(5, 0)]
|
|
150
|
+
}, {
|
|
151
|
+
name: 'comp-b',
|
|
152
|
+
files: [mkFile(2, 3)]
|
|
153
|
+
}]);
|
|
154
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b')]);
|
|
155
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
156
|
+
verbose: false,
|
|
157
|
+
duration: '2.5s'
|
|
158
|
+
});
|
|
159
|
+
(0, _chai().expect)(out).to.include('3 tests failed across 1 of 2 components');
|
|
160
|
+
});
|
|
161
|
+
it('collapses no-test components into a single hint line by default', () => {
|
|
162
|
+
const results = mkResults('teambit.react/react', [{
|
|
163
|
+
name: 'comp-a',
|
|
164
|
+
files: [mkFile(1, 0)]
|
|
165
|
+
}]);
|
|
166
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b'), mkComponent('comp-c')]);
|
|
167
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
168
|
+
verbose: false,
|
|
169
|
+
duration: '1s'
|
|
170
|
+
});
|
|
171
|
+
(0, _chai().expect)(out).to.include('2 components have no tests (run with --verbose to list)');
|
|
172
|
+
(0, _chai().expect)(out).to.not.include('my-scope/comp-b');
|
|
173
|
+
});
|
|
174
|
+
it('lists no-test component ids when verbose', () => {
|
|
175
|
+
const results = mkResults('teambit.react/react', [{
|
|
176
|
+
name: 'comp-a',
|
|
177
|
+
files: [mkFile(1, 0)]
|
|
178
|
+
}]);
|
|
179
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b'), mkComponent('comp-c')]);
|
|
180
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
181
|
+
verbose: true,
|
|
182
|
+
duration: '1s'
|
|
183
|
+
});
|
|
184
|
+
(0, _chai().expect)(out).to.include('2 components have no tests');
|
|
185
|
+
(0, _chai().expect)(out).to.include('my-scope/comp-b');
|
|
186
|
+
(0, _chai().expect)(out).to.include('my-scope/comp-c');
|
|
187
|
+
});
|
|
188
|
+
it('handles empty component list', () => {
|
|
189
|
+
const results = {
|
|
190
|
+
results: []
|
|
191
|
+
};
|
|
192
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, []);
|
|
193
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
194
|
+
verbose: false,
|
|
195
|
+
duration: '0s'
|
|
196
|
+
});
|
|
197
|
+
(0, _chai().expect)(out).to.include('no components to test');
|
|
198
|
+
});
|
|
199
|
+
it('emits only the final headline when summaryOnly is set', () => {
|
|
200
|
+
const results = mkResults('teambit.react/react', [{
|
|
201
|
+
name: 'comp-a',
|
|
202
|
+
files: [mkFile(5, 0)]
|
|
203
|
+
}, {
|
|
204
|
+
name: 'comp-b',
|
|
205
|
+
files: [mkFile(0, 2)]
|
|
206
|
+
}]);
|
|
207
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b')]);
|
|
208
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
209
|
+
verbose: false,
|
|
210
|
+
duration: '1s',
|
|
211
|
+
summaryOnly: true
|
|
212
|
+
});
|
|
213
|
+
(0, _chai().expect)(out).to.not.include('test results');
|
|
214
|
+
(0, _chai().expect)(out).to.not.include('my-scope/comp-a');
|
|
215
|
+
(0, _chai().expect)(out).to.include('2 tests failed across 1 of 2 components');
|
|
216
|
+
(0, _chai().expect)(out).to.include('Finished. (1s)');
|
|
217
|
+
});
|
|
218
|
+
it('surfaces env errors in a dedicated section', () => {
|
|
219
|
+
const err = new Error('tester crashed');
|
|
220
|
+
const compA = mkComponent('comp-a');
|
|
221
|
+
const results = {
|
|
222
|
+
results: [{
|
|
223
|
+
env: {
|
|
224
|
+
id: 'teambit.react/react',
|
|
225
|
+
components: [compA]
|
|
226
|
+
},
|
|
227
|
+
data: undefined,
|
|
228
|
+
error: err
|
|
229
|
+
}]
|
|
230
|
+
};
|
|
231
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [compA]);
|
|
232
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
233
|
+
verbose: false,
|
|
234
|
+
duration: '0.3s'
|
|
235
|
+
});
|
|
236
|
+
(0, _chai().expect)(out).to.include('tester errors');
|
|
237
|
+
(0, _chai().expect)(out).to.include('teambit.react/react');
|
|
238
|
+
(0, _chai().expect)(out).to.include('tester crashed');
|
|
239
|
+
(0, _chai().expect)(out).to.include('1 components targeted');
|
|
240
|
+
});
|
|
241
|
+
it('separates failed-tests component count from tester-error component count in failure headline', () => {
|
|
242
|
+
const err = new Error('parse error');
|
|
243
|
+
const results = mkResults('teambit.react/react', [{
|
|
244
|
+
name: 'comp-a',
|
|
245
|
+
files: [mkFile(2, 3)]
|
|
246
|
+
}, {
|
|
247
|
+
name: 'comp-b',
|
|
248
|
+
files: [mkFile(5, 0)]
|
|
249
|
+
}, {
|
|
250
|
+
name: 'comp-c',
|
|
251
|
+
files: [mkFile(0, 0, 0, err)]
|
|
252
|
+
}]);
|
|
253
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b'), mkComponent('comp-c')]);
|
|
254
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
255
|
+
verbose: false,
|
|
256
|
+
duration: '1s'
|
|
257
|
+
});
|
|
258
|
+
(0, _chai().expect)(out).to.include('3 tests failed across 1 of 3 components');
|
|
259
|
+
(0, _chai().expect)(out).to.include('(+1 components had tester errors)');
|
|
260
|
+
});
|
|
261
|
+
it('surfaces passed counts alongside tester errors when no tests failed', () => {
|
|
262
|
+
const err = new Error('parse error');
|
|
263
|
+
const results = mkResults('teambit.react/react', [{
|
|
264
|
+
name: 'comp-a',
|
|
265
|
+
files: [mkFile(10, 0)]
|
|
266
|
+
}, {
|
|
267
|
+
name: 'comp-b',
|
|
268
|
+
files: [mkFile(5, 0)]
|
|
269
|
+
}, {
|
|
270
|
+
name: 'comp-c',
|
|
271
|
+
files: [mkFile(0, 0, 0, err)]
|
|
272
|
+
}]);
|
|
273
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a'), mkComponent('comp-b'), mkComponent('comp-c')]);
|
|
274
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
275
|
+
verbose: false,
|
|
276
|
+
duration: '1s'
|
|
277
|
+
});
|
|
278
|
+
(0, _chai().expect)(out).to.include('15/15 tests passed across 2 components');
|
|
279
|
+
(0, _chai().expect)(out).to.include('1 components had tester errors');
|
|
280
|
+
(0, _chai().expect)(out).to.not.include('tester errors encountered (');
|
|
281
|
+
});
|
|
282
|
+
it('downgrades to a warning when all tests pass but tester exited non-zero (e.g. coverage threshold)', () => {
|
|
283
|
+
const results = mkResults('teambit.react/react', [{
|
|
284
|
+
name: 'comp-a',
|
|
285
|
+
files: [mkFile(5, 0)]
|
|
286
|
+
}]);
|
|
287
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a')]);
|
|
288
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
289
|
+
verbose: false,
|
|
290
|
+
duration: '1s',
|
|
291
|
+
failedDueToExitCode: true
|
|
292
|
+
});
|
|
293
|
+
(0, _chai().expect)(out).to.include('5/5 tests passed');
|
|
294
|
+
(0, _chai().expect)(out).to.include('non-zero code');
|
|
295
|
+
(0, _chai().expect)(out).to.not.include('tests failed across');
|
|
296
|
+
});
|
|
297
|
+
it('includes pending tests in the headline when present', () => {
|
|
298
|
+
const results = mkResults('teambit.react/react', [{
|
|
299
|
+
name: 'comp-a',
|
|
300
|
+
files: [mkFile(3, 0, 2)]
|
|
301
|
+
}]);
|
|
302
|
+
const summary = (0, _testOutputFormatter().aggregateTestResults)(results, [mkComponent('comp-a')]);
|
|
303
|
+
const out = (0, _testOutputFormatter().formatTestReport)(summary, {
|
|
304
|
+
verbose: false,
|
|
305
|
+
duration: '1s'
|
|
306
|
+
});
|
|
307
|
+
(0, _chai().expect)(out).to.include('2 pending');
|
|
308
|
+
(0, _chai().expect)(out).to.include('3/5 tests passed');
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
//# sourceMappingURL=test-output-formatter.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_component","_testsResults","_testOutputFormatter","_tester","mkId","name","ComponentID","fromString","mkComponent","id","mkFile","pass","failed","pending","error","TestsFiles","mkResults","envId","components","compResults","map","files","errors","componentId","results","TestsResult","every","f","hasFailure","some","c","length","testFiles","envComponents","env","Tests","hasErrors","describe","it","summary","aggregateTestResults","expect","totals","testsPassed","to","equal","testsFailed","testsPending","tested","withoutTests","componentsWithoutTests","toString","include","err","Error","compA","undefined","envErrors","have","lengthOf","message","affectedByEnvError","componentsAffectedByEnvError","componentsWithTests","hasError","out","formatTestReport","verbose","duration","not","summaryOnly","failedDueToExitCode"],"sources":["test-output-formatter.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { ComponentID } from '@teambit/component';\nimport { TestsResult, TestsFiles } from '@teambit/tests-results';\nimport type { Component } from '@teambit/component';\nimport { aggregateTestResults, formatTestReport } from './test-output-formatter';\nimport { Tests } from './tester';\nimport type { TestResults } from './tester.main.runtime';\n\nfunction mkId(name: string): ComponentID {\n return ComponentID.fromString(`my-scope/${name}`);\n}\n\nfunction mkComponent(name: string): Component {\n return { id: mkId(name) } as unknown as Component;\n}\n\nfunction mkFile(pass: number, failed: number, pending = 0, error?: Error): TestsFiles {\n return new TestsFiles('file.spec.ts', [], pass, failed, pending, 0, false, error);\n}\n\ntype CompFixture = { name: string; files: TestsFiles[]; errors?: Error[] };\n\nfunction mkResults(envId: string, components: CompFixture[]): TestResults {\n const compResults = components.map(({ name, files, errors }) => ({\n componentId: mkId(name),\n results: new TestsResult(\n files,\n files.every((f) => f.failed === 0 && !f.error),\n 0\n ),\n errors,\n }));\n const hasFailure = compResults.some(\n (c) => (c.errors?.length || 0) > 0 || c.results.testFiles.some((f) => f.failed > 0 || f.error)\n );\n const envComponents = components.map((c) => mkComponent(c.name));\n return {\n results: [{ env: { id: envId, components: envComponents } as any, data: new Tests(compResults) }],\n hasErrors: () => hasFailure,\n errors: [],\n } as unknown as TestResults;\n}\n\ndescribe('aggregateTestResults()', () => {\n it('counts passed/failed/pending across components', () => {\n const results = mkResults('teambit.react/react', [\n { name: 'comp-a', files: [mkFile(5, 0, 1)] },\n { name: 'comp-b', files: [mkFile(2, 1, 0)] },\n ]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a'), mkComponent('comp-b')]);\n expect(summary.totals.testsPassed).to.equal(7);\n expect(summary.totals.testsFailed).to.equal(1);\n expect(summary.totals.testsPending).to.equal(1);\n expect(summary.totals.tested).to.equal(2);\n expect(summary.totals.withoutTests).to.equal(0);\n });\n\n it('identifies components without tests', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(3, 0)] }]);\n const summary = aggregateTestResults(results, [\n mkComponent('comp-a'),\n mkComponent('comp-b'),\n mkComponent('comp-c'),\n ]);\n expect(summary.totals.withoutTests).to.equal(2);\n expect(summary.componentsWithoutTests.map((id) => id.toString())).to.include('my-scope/comp-b');\n expect(summary.componentsWithoutTests.map((id) => id.toString())).to.include('my-scope/comp-c');\n });\n\n it('surfaces env-level errors and keeps affected components out of the no-tests bucket', () => {\n const err = new Error('tester crashed');\n const compA = mkComponent('comp-a');\n const results = {\n results: [{ env: { id: 'teambit.react/react', components: [compA] } as any, data: undefined, error: err }],\n } as unknown as TestResults;\n const summary = aggregateTestResults(results, [compA]);\n expect(summary.envErrors).to.have.lengthOf(1);\n expect(summary.envErrors[0].error.message).to.equal('tester crashed');\n expect(summary.totals.withoutTests).to.equal(0);\n expect(summary.totals.affectedByEnvError).to.equal(1);\n expect(summary.componentsAffectedByEnvError.map((id) => id.toString())).to.include('my-scope/comp-a');\n });\n\n it('flags components with tester errors on test files', () => {\n const err = new Error('parse error');\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(0, 0, 0, err)] }]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a')]);\n expect(summary.componentsWithTests[0].hasError).to.equal(true);\n });\n});\n\ndescribe('formatTestReport()', () => {\n it('renders a green success summary when all pass', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(5, 0)] }]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a')]);\n const out = formatTestReport(summary, { verbose: false, duration: '1.2s' });\n expect(out).to.include('test results');\n expect(out).to.include('my-scope/comp-a');\n expect(out).to.include('5 passed');\n expect(out).to.include('5/5 tests passed');\n expect(out).to.include('Finished. (1.2s)');\n });\n\n it('renders warning summary with failure count when any fail', () => {\n const results = mkResults('teambit.react/react', [\n { name: 'comp-a', files: [mkFile(5, 0)] },\n { name: 'comp-b', files: [mkFile(2, 3)] },\n ]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a'), mkComponent('comp-b')]);\n const out = formatTestReport(summary, { verbose: false, duration: '2.5s' });\n expect(out).to.include('3 tests failed across 1 of 2 components');\n });\n\n it('collapses no-test components into a single hint line by default', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(1, 0)] }]);\n const summary = aggregateTestResults(results, [\n mkComponent('comp-a'),\n mkComponent('comp-b'),\n mkComponent('comp-c'),\n ]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s' });\n expect(out).to.include('2 components have no tests (run with --verbose to list)');\n expect(out).to.not.include('my-scope/comp-b');\n });\n\n it('lists no-test component ids when verbose', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(1, 0)] }]);\n const summary = aggregateTestResults(results, [\n mkComponent('comp-a'),\n mkComponent('comp-b'),\n mkComponent('comp-c'),\n ]);\n const out = formatTestReport(summary, { verbose: true, duration: '1s' });\n expect(out).to.include('2 components have no tests');\n expect(out).to.include('my-scope/comp-b');\n expect(out).to.include('my-scope/comp-c');\n });\n\n it('handles empty component list', () => {\n const results = { results: [] } as unknown as TestResults;\n const summary = aggregateTestResults(results, []);\n const out = formatTestReport(summary, { verbose: false, duration: '0s' });\n expect(out).to.include('no components to test');\n });\n\n it('emits only the final headline when summaryOnly is set', () => {\n const results = mkResults('teambit.react/react', [\n { name: 'comp-a', files: [mkFile(5, 0)] },\n { name: 'comp-b', files: [mkFile(0, 2)] },\n ]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a'), mkComponent('comp-b')]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s', summaryOnly: true });\n expect(out).to.not.include('test results');\n expect(out).to.not.include('my-scope/comp-a');\n expect(out).to.include('2 tests failed across 1 of 2 components');\n expect(out).to.include('Finished. (1s)');\n });\n\n it('surfaces env errors in a dedicated section', () => {\n const err = new Error('tester crashed');\n const compA = mkComponent('comp-a');\n const results = {\n results: [{ env: { id: 'teambit.react/react', components: [compA] } as any, data: undefined, error: err }],\n } as unknown as TestResults;\n const summary = aggregateTestResults(results, [compA]);\n const out = formatTestReport(summary, { verbose: false, duration: '0.3s' });\n expect(out).to.include('tester errors');\n expect(out).to.include('teambit.react/react');\n expect(out).to.include('tester crashed');\n expect(out).to.include('1 components targeted');\n });\n\n it('separates failed-tests component count from tester-error component count in failure headline', () => {\n const err = new Error('parse error');\n const results = mkResults('teambit.react/react', [\n { name: 'comp-a', files: [mkFile(2, 3)] },\n { name: 'comp-b', files: [mkFile(5, 0)] },\n { name: 'comp-c', files: [mkFile(0, 0, 0, err)] },\n ]);\n const summary = aggregateTestResults(results, [\n mkComponent('comp-a'),\n mkComponent('comp-b'),\n mkComponent('comp-c'),\n ]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s' });\n expect(out).to.include('3 tests failed across 1 of 3 components');\n expect(out).to.include('(+1 components had tester errors)');\n });\n\n it('surfaces passed counts alongside tester errors when no tests failed', () => {\n const err = new Error('parse error');\n const results = mkResults('teambit.react/react', [\n { name: 'comp-a', files: [mkFile(10, 0)] },\n { name: 'comp-b', files: [mkFile(5, 0)] },\n { name: 'comp-c', files: [mkFile(0, 0, 0, err)] },\n ]);\n const summary = aggregateTestResults(results, [\n mkComponent('comp-a'),\n mkComponent('comp-b'),\n mkComponent('comp-c'),\n ]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s' });\n expect(out).to.include('15/15 tests passed across 2 components');\n expect(out).to.include('1 components had tester errors');\n expect(out).to.not.include('tester errors encountered (');\n });\n\n it('downgrades to a warning when all tests pass but tester exited non-zero (e.g. coverage threshold)', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(5, 0)] }]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a')]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s', failedDueToExitCode: true });\n expect(out).to.include('5/5 tests passed');\n expect(out).to.include('non-zero code');\n expect(out).to.not.include('tests failed across');\n });\n\n it('includes pending tests in the headline when present', () => {\n const results = mkResults('teambit.react/react', [{ name: 'comp-a', files: [mkFile(3, 0, 2)] }]);\n const summary = aggregateTestResults(results, [mkComponent('comp-a')]);\n const out = formatTestReport(summary, { verbose: false, duration: '1s' });\n expect(out).to.include('2 pending');\n expect(out).to.include('3/5 tests passed');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,qBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,oBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAASM,IAAIA,CAACC,IAAY,EAAe;EACvC,OAAOC,wBAAW,CAAC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AAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAAE,CAAC,CAAC,CAAC;IAChG,MAAM6B,OAAO,GAAG,IAAAC,2CAAoB,EAAChB,OAAO,EAAE,CAAChB,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtE,MAAMyD,GAAG,GAAG,IAAAC,uCAAgB,EAAC3B,OAAO,EAAE;MAAE4B,OAAO,EAAE,KAAK;MAAEC,QAAQ,EAAE;IAAK,CAAC,CAAC;IACzE,IAAA3B,cAAM,EAACwB,GAAG,CAAC,CAACrB,EAAE,CAACQ,OAAO,CAAC,WAAW,CAAC;IACnC,IAAAX,cAAM,EAACwB,GAAG,CAAC,CAACrB,EAAE,CAACQ,OAAO,CAAC,kBAAkB,CAAC;EAC5C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/dist/test.cmd.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ type TestFlags = {
|
|
|
12
12
|
junit?: string;
|
|
13
13
|
coverage?: boolean;
|
|
14
14
|
updateSnapshot: boolean;
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
summary?: boolean;
|
|
15
17
|
};
|
|
16
18
|
export declare class TestCmd implements Command {
|
|
17
19
|
private tester;
|
|
@@ -29,10 +31,10 @@ export declare class TestCmd implements Command {
|
|
|
29
31
|
group: string;
|
|
30
32
|
options: CommandOptions;
|
|
31
33
|
constructor(tester: TesterMain, workspace: Workspace, logger: Logger);
|
|
32
|
-
report([userPattern]: [string], { watch, debug, all, env, scope, junit, coverage, unmodified, updateSnapshot, }: TestFlags): Promise<"" | {
|
|
34
|
+
report([userPattern]: [string], { watch, debug, all, env, scope, junit, coverage, unmodified, updateSnapshot, verbose, summary: summaryOnly, }: TestFlags): Promise<"" | {
|
|
33
35
|
code: number;
|
|
34
36
|
data: string;
|
|
35
37
|
}>;
|
|
36
|
-
json([userPattern]: [string], { watch, debug, env, junit, coverage, unmodified, updateSnapshot, }: TestFlags): Promise<GenericObject>;
|
|
38
|
+
json([userPattern]: [string], { watch, debug, env, junit, coverage, unmodified, updateSnapshot, summary: summaryOnly, }: TestFlags): Promise<GenericObject>;
|
|
37
39
|
}
|
|
38
40
|
export {};
|
package/dist/test.cmd.js
CHANGED
|
@@ -39,6 +39,13 @@ function _legacy() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
41
|
}
|
|
42
|
+
function _testOutputFormatter() {
|
|
43
|
+
const data = require("./test-output-formatter");
|
|
44
|
+
_testOutputFormatter = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
42
49
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
43
50
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
44
51
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -62,7 +69,7 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
62
69
|
}]);
|
|
63
70
|
_defineProperty(this, "alias", 'at');
|
|
64
71
|
_defineProperty(this, "group", 'testing');
|
|
65
|
-
_defineProperty(this, "options", [['w', 'watch', 'start the tester in watch mode.'], ['d', 'debug', 'start the tester in debug mode.'], ['a', 'all', 'DEPRECATED. (use --unmodified)'], ['u', 'unmodified', 'test all components, not only new and modified'], ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'], ['', 'coverage', 'show code coverage data'], ['e', 'env <id>', 'test only components assigned the given env'], ['', 'update-snapshot', 'if supported by the tester, re-record every snapshot that fails during the test run'], ['s', 'scope <scope-name>', 'DEPRECATED. (use the pattern instead, e.g. "scopeName/**"). name of the scope to test'], ['j', 'json', 'return the results in json format']
|
|
72
|
+
_defineProperty(this, "options", [['w', 'watch', 'start the tester in watch mode.'], ['d', 'debug', 'start the tester in debug mode.'], ['a', 'all', 'DEPRECATED. (use --unmodified)'], ['u', 'unmodified', 'test all components, not only new and modified'], ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'], ['', 'coverage', 'show code coverage data'], ['e', 'env <id>', 'test only components assigned the given env'], ['', 'update-snapshot', 'if supported by the tester, re-record every snapshot that fails during the test run'], ['s', 'scope <scope-name>', 'DEPRECATED. (use the pattern instead, e.g. "scopeName/**"). name of the scope to test'], ['j', 'json', 'return the results in json format'], ['', 'verbose', 'list the component ids that have no tests (default collapses them into a count)'], ['', 'summary', 'suppress tester output, print only the final pass/fail headline (or summary object with --json)']
|
|
66
73
|
// TODO: we need to reduce this redundant casting every time.
|
|
67
74
|
]);
|
|
68
75
|
}
|
|
@@ -75,7 +82,9 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
75
82
|
junit,
|
|
76
83
|
coverage = false,
|
|
77
84
|
unmodified = false,
|
|
78
|
-
updateSnapshot = false
|
|
85
|
+
updateSnapshot = false,
|
|
86
|
+
verbose = false,
|
|
87
|
+
summary: summaryOnly = false
|
|
79
88
|
}) {
|
|
80
89
|
const timer = _toolboxTime().Timer.create();
|
|
81
90
|
const scopeName = typeof scope === 'string' ? scope : undefined;
|
|
@@ -103,8 +112,11 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
103
112
|
data
|
|
104
113
|
};
|
|
105
114
|
}
|
|
106
|
-
|
|
115
|
+
if (!summaryOnly) {
|
|
116
|
+
this.logger.console(`testing total of ${components.length} components in workspace '${_chalk().default.cyan(this.workspace.name)}'`);
|
|
117
|
+
}
|
|
107
118
|
let code = 0;
|
|
119
|
+
let tests;
|
|
108
120
|
if (watch && !debug) {
|
|
109
121
|
// avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be
|
|
110
122
|
// swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first
|
|
@@ -118,14 +130,23 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
118
130
|
updateSnapshot
|
|
119
131
|
});
|
|
120
132
|
} else {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
// testers such as Jest reassign `console.warn` to forward into `this.logger.warn` inside their `test()`,
|
|
134
|
+
// bypassing our stdout/console monkey-patch. also turn the logger off so those re-routed calls don't surface.
|
|
135
|
+
if (summaryOnly) this.logger.off();
|
|
136
|
+
const restore = summaryOnly ? silenceConsoleAndStdout() : undefined;
|
|
137
|
+
try {
|
|
138
|
+
tests = await this.tester.test(components, {
|
|
139
|
+
watch,
|
|
140
|
+
debug,
|
|
141
|
+
env,
|
|
142
|
+
junit,
|
|
143
|
+
coverage,
|
|
144
|
+
updateSnapshot
|
|
145
|
+
});
|
|
146
|
+
} finally {
|
|
147
|
+
restore?.();
|
|
148
|
+
if (summaryOnly) this.logger.on();
|
|
149
|
+
}
|
|
129
150
|
if (tests.hasErrors()) code = 1;
|
|
130
151
|
if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {
|
|
131
152
|
// this is needed for testers such as "vitest", where it sets the exitCode to non zero when the coverage is not met.
|
|
@@ -136,7 +157,14 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
136
157
|
seconds
|
|
137
158
|
} = timer.stop();
|
|
138
159
|
if (watch) return '';
|
|
139
|
-
const
|
|
160
|
+
const summary = tests ? (0, _testOutputFormatter().aggregateTestResults)(tests, components) : undefined;
|
|
161
|
+
const failedDueToExitCode = code !== 0 && !!tests && !tests.hasErrors();
|
|
162
|
+
const data = summary ? `${summaryOnly ? '' : '\n'}${(0, _testOutputFormatter().formatTestReport)(summary, {
|
|
163
|
+
verbose,
|
|
164
|
+
duration: `${seconds}s`,
|
|
165
|
+
summaryOnly,
|
|
166
|
+
failedDueToExitCode
|
|
167
|
+
})}` : (0, _cli().formatHint)(`tests completed in ${seconds} seconds`);
|
|
140
168
|
return {
|
|
141
169
|
code,
|
|
142
170
|
data
|
|
@@ -149,7 +177,8 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
149
177
|
junit,
|
|
150
178
|
coverage = false,
|
|
151
179
|
unmodified = false,
|
|
152
|
-
updateSnapshot = false
|
|
180
|
+
updateSnapshot = false,
|
|
181
|
+
summary: summaryOnly = false
|
|
153
182
|
}) {
|
|
154
183
|
const timer = _toolboxTime().Timer.create();
|
|
155
184
|
timer.start();
|
|
@@ -172,6 +201,9 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
172
201
|
};
|
|
173
202
|
}
|
|
174
203
|
let code = 0;
|
|
204
|
+
// also disable the logger: testers like Jest reassign `console.warn` to `this.logger.warn`,
|
|
205
|
+
// which bypasses the stdout/console silencer and can corrupt machine-readable JSON output.
|
|
206
|
+
this.logger.off();
|
|
175
207
|
const restore = silenceConsoleAndStdout();
|
|
176
208
|
let tests;
|
|
177
209
|
try {
|
|
@@ -183,16 +215,44 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
183
215
|
coverage,
|
|
184
216
|
updateSnapshot
|
|
185
217
|
});
|
|
186
|
-
}
|
|
218
|
+
} finally {
|
|
187
219
|
restore();
|
|
188
|
-
|
|
220
|
+
this.logger.on();
|
|
189
221
|
}
|
|
190
|
-
restore();
|
|
191
222
|
if (tests.hasErrors()) code = 1;
|
|
192
223
|
if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {
|
|
193
224
|
// this is needed for testers such as "vitest", where it sets the exitCode to non zero when the coverage is not met.
|
|
194
225
|
code = process.exitCode;
|
|
195
226
|
}
|
|
227
|
+
const aggregated = (0, _testOutputFormatter().aggregateTestResults)(tests, components);
|
|
228
|
+
const summary = {
|
|
229
|
+
totals: aggregated.totals,
|
|
230
|
+
componentsWithTests: aggregated.componentsWithTests.map(c => ({
|
|
231
|
+
id: c.id.toString({
|
|
232
|
+
ignoreVersion: true
|
|
233
|
+
}),
|
|
234
|
+
passed: c.passed,
|
|
235
|
+
failed: c.failed,
|
|
236
|
+
pending: c.pending,
|
|
237
|
+
hasError: c.hasError
|
|
238
|
+
})),
|
|
239
|
+
componentsWithoutTests: aggregated.componentsWithoutTests.map(id => id.toString({
|
|
240
|
+
ignoreVersion: true
|
|
241
|
+
})),
|
|
242
|
+
componentsAffectedByEnvError: aggregated.componentsAffectedByEnvError.map(id => id.toString({
|
|
243
|
+
ignoreVersion: true
|
|
244
|
+
})),
|
|
245
|
+
envErrors: aggregated.envErrors.map(e => ({
|
|
246
|
+
envId: e.envId,
|
|
247
|
+
message: e.error.message
|
|
248
|
+
}))
|
|
249
|
+
};
|
|
250
|
+
if (summaryOnly) {
|
|
251
|
+
return {
|
|
252
|
+
code,
|
|
253
|
+
data: summary
|
|
254
|
+
};
|
|
255
|
+
}
|
|
196
256
|
const data = tests.results.map(r => ({
|
|
197
257
|
data: {
|
|
198
258
|
components: r.data?.components.map(c => _objectSpread(_objectSpread({}, c), {}, {
|
|
@@ -216,25 +276,28 @@ supports watch mode, coverage reporting, and debug mode for development workflow
|
|
|
216
276
|
*/
|
|
217
277
|
exports.TestCmd = TestCmd;
|
|
218
278
|
function silenceConsoleAndStdout() {
|
|
219
|
-
|
|
220
|
-
const originalConsole =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
for (const method of
|
|
279
|
+
const CONSOLE_METHODS = ['log', 'warn', 'error', 'info', 'debug'];
|
|
280
|
+
const originalConsole = Object.fromEntries(
|
|
281
|
+
// eslint-disable-next-line no-console
|
|
282
|
+
CONSOLE_METHODS.map(m => [m, console[m]]));
|
|
283
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
284
|
+
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
285
|
+
for (const method of CONSOLE_METHODS) {
|
|
226
286
|
// eslint-disable-next-line no-console
|
|
227
287
|
console[method] = () => {};
|
|
228
288
|
}
|
|
229
289
|
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
290
|
+
// process.stdout.write(chunk, encoding?, callback?) — callers may rely on the optional
|
|
291
|
+
// callback firing. Invoke it so we don't leave writers hanging.
|
|
292
|
+
const stubWrite = (...args) => {
|
|
293
|
+
const cb = args.find(a => typeof a === 'function');
|
|
294
|
+
if (cb) cb();
|
|
295
|
+
return true;
|
|
296
|
+
};
|
|
297
|
+
process.stdout.write = stubWrite;
|
|
298
|
+
process.stderr.write = stubWrite;
|
|
235
299
|
return () => {
|
|
236
|
-
for (const method of
|
|
237
|
-
// @ts-ignore
|
|
300
|
+
for (const method of CONSOLE_METHODS) {
|
|
238
301
|
// eslint-disable-next-line no-console
|
|
239
302
|
console[method] = originalConsole[method];
|
|
240
303
|
}
|
package/dist/test.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_chalk","_interopRequireDefault","_workspace","_toolboxTime","_legacy","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TestCmd","constructor","tester","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","userPattern","watch","debug","all","env","scope","junit","coverage","unmodified","updateSnapshot","timer","Timer","create","scopeName","undefined","consoleWarning","start","OutsideWorkspaceError","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","formatHint","code","console","chalk","cyan","off","tests","test","hasErrors","process","exitCode","seconds","stop","formatSuccessSummary","json","info","restore","silenceConsoleAndStdout","err","results","map","c","componentId","toString","errors","error","exports","originalConsole","originalStdoutWrite","stdout","write","originalStderrWrite","stderr","method"],"sources":["test.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions, GenericObject } from '@teambit/cli';\nimport { formatHint, formatSuccessSummary } from '@teambit/cli';\nimport chalk from 'chalk';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { Timer } from '@teambit/toolbox.time.timer';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { TesterMain, TestResults } from './tester.main.runtime';\n\ntype TestFlags = {\n watch: boolean;\n debug: boolean;\n all: boolean;\n unmodified: boolean;\n env?: string;\n scope?: string;\n junit?: string;\n coverage?: boolean;\n updateSnapshot: boolean;\n};\n\nexport class TestCmd implements Command {\n name = 'test [component-pattern]';\n description = 'run component tests';\n extendedDescription = `executes tests using the testing framework configured by each component's environment (Jest, Mocha, etc.).\nby default only runs tests for new and modified components. use --unmodified to test all components.\nsupports watch mode, coverage reporting, and debug mode for development workflows.`;\n helpUrl = 'reference/testing/tester-overview';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'at';\n group = 'testing';\n options = [\n ['w', 'watch', 'start the tester in watch mode.'],\n ['d', 'debug', 'start the tester in debug mode.'],\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'test all components, not only new and modified'],\n ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'],\n ['', 'coverage', 'show code coverage data'],\n ['e', 'env <id>', 'test only components assigned the given env'],\n ['', 'update-snapshot', 'if supported by the tester, re-record every snapshot that fails during the test run'],\n [\n 's',\n 'scope <scope-name>',\n 'DEPRECATED. (use the pattern instead, e.g. \"scopeName/**\"). name of the scope to test',\n ],\n ['j', 'json', 'return the results in json format'],\n // TODO: we need to reduce this redundant casting every time.\n ] as CommandOptions;\n\n constructor(\n private tester: TesterMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [userPattern]: [string],\n {\n watch = false,\n debug = false,\n all = false,\n env,\n scope,\n junit,\n coverage = false,\n unmodified = false,\n updateSnapshot = false,\n }: TestFlags\n ) {\n const timer = Timer.create();\n const scopeName = typeof scope === 'string' ? scope : undefined;\n if (scopeName) {\n this.logger.consoleWarning(\n `--scope is deprecated, use the pattern argument instead. e.g. \"scopeName/**\" for the entire scope`\n );\n }\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n timer.start();\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n const getPatternWithScope = () => {\n if (!userPattern && !scope) return undefined;\n const pattern = userPattern || '**';\n return scopeName ? `${scopeName}/${pattern}` : pattern;\n };\n const patternWithScope = getPatternWithScope();\n // If pattern is provided, don't pass the unmodified flag as \"all\" - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(\n patternWithScope ? false : unmodified,\n patternWithScope,\n true\n );\n if (!components.length) {\n const data = formatHint(\n `no components found to test.\\nuse \"--unmodified\" flag to test all components or specify the ids to test.\\notherwise, only new and modified components will be tested`\n );\n return {\n code: 0,\n data,\n };\n }\n\n this.logger.console(\n `testing total of ${components.length} components in workspace '${chalk.cyan(this.workspace.name)}'`\n );\n\n let code = 0;\n if (watch && !debug) {\n // avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be\n // swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first\n // place, these errors won't be shown)\n this.logger.off();\n await this.tester.watch(components, {\n watch,\n debug,\n env,\n coverage,\n updateSnapshot,\n });\n } else {\n const tests = await this.tester.test(components, {\n watch,\n debug,\n env,\n junit,\n coverage,\n updateSnapshot,\n });\n if (tests.hasErrors()) code = 1;\n if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {\n // this is needed for testers such as \"vitest\", where it sets the exitCode to non zero when the coverage is not met.\n code = process.exitCode;\n }\n }\n const { seconds } = timer.stop();\n\n if (watch) return '';\n const data =\n code === 0\n ? formatSuccessSummary(`tests completed in ${seconds} seconds`)\n : formatHint(`tests completed in ${seconds} seconds`);\n return {\n code,\n data,\n };\n }\n\n async json(\n [userPattern]: [string],\n {\n watch = false,\n debug = false,\n env,\n junit,\n coverage = false,\n unmodified = false,\n updateSnapshot = false,\n }: TestFlags\n ): Promise<GenericObject> {\n const timer = Timer.create();\n timer.start();\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n const getPatternWithScope = () => {\n if (!userPattern) return undefined;\n const pattern = userPattern || '**';\n return pattern;\n };\n const patternWithScope = getPatternWithScope();\n // If pattern is provided, don't pass the unmodified flag as \"all\" - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(\n patternWithScope ? false : unmodified,\n patternWithScope,\n true\n );\n if (!components.length) {\n this.logger.info(`no components found to test.\n use \"--unmodified\" flag to test all components or specify the ids to test.\n otherwise, only new and modified components will be tested`);\n return {\n code: 0,\n data: [],\n };\n }\n\n let code = 0;\n const restore = silenceConsoleAndStdout();\n let tests: TestResults;\n try {\n tests = await this.tester.test(components, {\n watch,\n debug,\n env,\n junit,\n coverage,\n updateSnapshot,\n });\n } catch (err) {\n restore();\n throw err;\n }\n restore();\n if (tests.hasErrors()) code = 1;\n if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {\n // this is needed for testers such as \"vitest\", where it sets the exitCode to non zero when the coverage is not met.\n code = process.exitCode;\n }\n\n const data = tests.results.map((r) => ({\n data: {\n components: r.data?.components.map((c) => ({\n ...c,\n componentId: c.componentId.toString(),\n })),\n errors: r.data?.errors,\n },\n error: r.error,\n }));\n\n return {\n code,\n data,\n };\n }\n}\n\n/**\n * Disables all console logging (via console.*) and direct writes to\n * process.stdout / process.stderr. Returns a function that, when called,\n * restores everything back to normal.\n */\nfunction silenceConsoleAndStdout(): () => void {\n // Keep copies of the original methods so we can restore them later\n const originalConsole = { ...console };\n const originalStdoutWrite = process.stdout.write;\n const originalStderrWrite = process.stderr.write;\n\n // No-op implementations for console.* methods\n for (const method of ['log', 'warn', 'error', 'info', 'debug'] as const) {\n // eslint-disable-next-line no-console\n console[method] = () => {};\n }\n\n // Replace process.stdout.write and process.stderr.write with no-ops\n process.stdout.write = (() => true) as any;\n process.stderr.write = (() => true) as any;\n\n // Return a function to restore original behavior\n return () => {\n for (const method of Object.keys(originalConsole) as (keyof Console)[]) {\n // @ts-ignore\n // eslint-disable-next-line no-console\n console[method] = originalConsole[method];\n }\n process.stdout.write = originalStdoutWrite;\n process.stderr.write = originalStderrWrite;\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,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mBAAmB,GAAGnB,OAAO,CAACoB,MAAM,CAACC,KAAK;EAChD,MAAMC,mBAAmB,GAAGtB,OAAO,CAACuB,MAAM,CAACF,KAAK;;EAEhD;EACA,KAAK,MAAMG,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAW;IACvE;IACA/B,OAAO,CAAC+B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;EAC5B;;EAEA;EACAxB,OAAO,CAACoB,MAAM,CAACC,KAAK,GAAI,MAAM,IAAY;EAC1CrB,OAAO,CAACuB,MAAM,CAACF,KAAK,GAAI,MAAM,IAAY;;EAE1C;EACA,OAAO,MAAM;IACX,KAAK,MAAMG,MAAM,IAAI9F,MAAM,CAACC,IAAI,CAACuF,eAAe,CAAC,EAAuB;MACtE;MACA;MACAzB,OAAO,CAAC+B,MAAM,CAAC,GAAGN,eAAe,CAACM,MAAM,CAAC;IAC3C;IACAxB,OAAO,CAACoB,MAAM,CAACC,KAAK,GAAGF,mBAAmB;IAC1CnB,OAAO,CAACuB,MAAM,CAACF,KAAK,GAAGC,mBAAmB;EAC5C,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_chalk","_interopRequireDefault","_workspace","_toolboxTime","_legacy","_testOutputFormatter","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TestCmd","constructor","tester","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","userPattern","watch","debug","all","env","scope","junit","coverage","unmodified","updateSnapshot","verbose","summary","summaryOnly","timer","Timer","create","scopeName","undefined","consoleWarning","start","OutsideWorkspaceError","getPatternWithScope","pattern","patternWithScope","components","getComponentsByUserInput","formatHint","code","console","chalk","cyan","tests","off","restore","silenceConsoleAndStdout","test","on","hasErrors","process","exitCode","seconds","stop","aggregateTestResults","failedDueToExitCode","formatTestReport","duration","json","info","aggregated","totals","componentsWithTests","map","c","id","toString","ignoreVersion","passed","failed","pending","hasError","componentsWithoutTests","componentsAffectedByEnvError","envErrors","envId","message","error","results","componentId","errors","exports","CONSOLE_METHODS","originalConsole","fromEntries","m","originalStdoutWrite","stdout","write","bind","originalStderrWrite","stderr","method","stubWrite","args","cb","find","a"],"sources":["test.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions, GenericObject } from '@teambit/cli';\nimport { formatHint } from '@teambit/cli';\nimport chalk from 'chalk';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { Timer } from '@teambit/toolbox.time.timer';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { TesterMain, TestResults } from './tester.main.runtime';\nimport { aggregateTestResults, formatTestReport } from './test-output-formatter';\n\ntype TestFlags = {\n watch: boolean;\n debug: boolean;\n all: boolean;\n unmodified: boolean;\n env?: string;\n scope?: string;\n junit?: string;\n coverage?: boolean;\n updateSnapshot: boolean;\n verbose?: boolean;\n summary?: boolean;\n};\n\nexport class TestCmd implements Command {\n name = 'test [component-pattern]';\n description = 'run component tests';\n extendedDescription = `executes tests using the testing framework configured by each component's environment (Jest, Mocha, etc.).\nby default only runs tests for new and modified components. use --unmodified to test all components.\nsupports watch mode, coverage reporting, and debug mode for development workflows.`;\n helpUrl = 'reference/testing/tester-overview';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = 'at';\n group = 'testing';\n options = [\n ['w', 'watch', 'start the tester in watch mode.'],\n ['d', 'debug', 'start the tester in debug mode.'],\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'test all components, not only new and modified'],\n ['', 'junit <filepath>', 'write tests results as JUnit XML format into the specified file path'],\n ['', 'coverage', 'show code coverage data'],\n ['e', 'env <id>', 'test only components assigned the given env'],\n ['', 'update-snapshot', 'if supported by the tester, re-record every snapshot that fails during the test run'],\n [\n 's',\n 'scope <scope-name>',\n 'DEPRECATED. (use the pattern instead, e.g. \"scopeName/**\"). name of the scope to test',\n ],\n ['j', 'json', 'return the results in json format'],\n ['', 'verbose', 'list the component ids that have no tests (default collapses them into a count)'],\n ['', 'summary', 'suppress tester output, print only the final pass/fail headline (or summary object with --json)'],\n // TODO: we need to reduce this redundant casting every time.\n ] as CommandOptions;\n\n constructor(\n private tester: TesterMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [userPattern]: [string],\n {\n watch = false,\n debug = false,\n all = false,\n env,\n scope,\n junit,\n coverage = false,\n unmodified = false,\n updateSnapshot = false,\n verbose = false,\n summary: summaryOnly = false,\n }: TestFlags\n ) {\n const timer = Timer.create();\n const scopeName = typeof scope === 'string' ? scope : undefined;\n if (scopeName) {\n this.logger.consoleWarning(\n `--scope is deprecated, use the pattern argument instead. e.g. \"scopeName/**\" for the entire scope`\n );\n }\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n timer.start();\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n const getPatternWithScope = () => {\n if (!userPattern && !scope) return undefined;\n const pattern = userPattern || '**';\n return scopeName ? `${scopeName}/${pattern}` : pattern;\n };\n const patternWithScope = getPatternWithScope();\n // If pattern is provided, don't pass the unmodified flag as \"all\" - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(\n patternWithScope ? false : unmodified,\n patternWithScope,\n true\n );\n if (!components.length) {\n const data = formatHint(\n `no components found to test.\\nuse \"--unmodified\" flag to test all components or specify the ids to test.\\notherwise, only new and modified components will be tested`\n );\n return {\n code: 0,\n data,\n };\n }\n\n if (!summaryOnly) {\n this.logger.console(\n `testing total of ${components.length} components in workspace '${chalk.cyan(this.workspace.name)}'`\n );\n }\n\n let code = 0;\n let tests: TestResults | undefined;\n if (watch && !debug) {\n // avoid turning off the logger for non-watch scenario. otherwise, when this aspect throws errors, they'll be\n // swallowed. (Jest errors are shown regardless via Jest, but if the tester is unable to run Jest in the first\n // place, these errors won't be shown)\n this.logger.off();\n await this.tester.watch(components, {\n watch,\n debug,\n env,\n coverage,\n updateSnapshot,\n });\n } else {\n // testers such as Jest reassign `console.warn` to forward into `this.logger.warn` inside their `test()`,\n // bypassing our stdout/console monkey-patch. also turn the logger off so those re-routed calls don't surface.\n if (summaryOnly) this.logger.off();\n const restore = summaryOnly ? silenceConsoleAndStdout() : undefined;\n try {\n tests = await this.tester.test(components, {\n watch,\n debug,\n env,\n junit,\n coverage,\n updateSnapshot,\n });\n } finally {\n restore?.();\n if (summaryOnly) this.logger.on();\n }\n if (tests.hasErrors()) code = 1;\n if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {\n // this is needed for testers such as \"vitest\", where it sets the exitCode to non zero when the coverage is not met.\n code = process.exitCode;\n }\n }\n const { seconds } = timer.stop();\n\n if (watch) return '';\n const summary = tests ? aggregateTestResults(tests, components) : undefined;\n const failedDueToExitCode = code !== 0 && !!tests && !tests.hasErrors();\n const data = summary\n ? `${summaryOnly ? '' : '\\n'}${formatTestReport(summary, { verbose, duration: `${seconds}s`, summaryOnly, failedDueToExitCode })}`\n : formatHint(`tests completed in ${seconds} seconds`);\n return {\n code,\n data,\n };\n }\n\n async json(\n [userPattern]: [string],\n {\n watch = false,\n debug = false,\n env,\n junit,\n coverage = false,\n unmodified = false,\n updateSnapshot = false,\n summary: summaryOnly = false,\n }: TestFlags\n ): Promise<GenericObject> {\n const timer = Timer.create();\n timer.start();\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n const getPatternWithScope = () => {\n if (!userPattern) return undefined;\n const pattern = userPattern || '**';\n return pattern;\n };\n const patternWithScope = getPatternWithScope();\n // If pattern is provided, don't pass the unmodified flag as \"all\" - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(\n patternWithScope ? false : unmodified,\n patternWithScope,\n true\n );\n if (!components.length) {\n this.logger.info(`no components found to test.\n use \"--unmodified\" flag to test all components or specify the ids to test.\n otherwise, only new and modified components will be tested`);\n return {\n code: 0,\n data: [],\n };\n }\n\n let code = 0;\n // also disable the logger: testers like Jest reassign `console.warn` to `this.logger.warn`,\n // which bypasses the stdout/console silencer and can corrupt machine-readable JSON output.\n this.logger.off();\n const restore = silenceConsoleAndStdout();\n let tests: TestResults;\n try {\n tests = await this.tester.test(components, {\n watch,\n debug,\n env,\n junit,\n coverage,\n updateSnapshot,\n });\n } finally {\n restore();\n this.logger.on();\n }\n if (tests.hasErrors()) code = 1;\n if (process.exitCode && process.exitCode !== 0 && typeof process.exitCode === 'number') {\n // this is needed for testers such as \"vitest\", where it sets the exitCode to non zero when the coverage is not met.\n code = process.exitCode;\n }\n\n const aggregated = aggregateTestResults(tests, components);\n const summary = {\n totals: aggregated.totals,\n componentsWithTests: aggregated.componentsWithTests.map((c) => ({\n id: c.id.toString({ ignoreVersion: true }),\n passed: c.passed,\n failed: c.failed,\n pending: c.pending,\n hasError: c.hasError,\n })),\n componentsWithoutTests: aggregated.componentsWithoutTests.map((id) => id.toString({ ignoreVersion: true })),\n componentsAffectedByEnvError: aggregated.componentsAffectedByEnvError.map((id) =>\n id.toString({ ignoreVersion: true })\n ),\n envErrors: aggregated.envErrors.map((e) => ({ envId: e.envId, message: e.error.message })),\n };\n\n if (summaryOnly) {\n return { code, data: summary };\n }\n\n const data = tests.results.map((r) => ({\n data: {\n components: r.data?.components.map((c) => ({\n ...c,\n componentId: c.componentId.toString(),\n })),\n errors: r.data?.errors,\n },\n error: r.error,\n }));\n\n return {\n code,\n data,\n };\n }\n}\n\n/**\n * Disables all console logging (via console.*) and direct writes to\n * process.stdout / process.stderr. Returns a function that, when called,\n * restores everything back to normal.\n */\nfunction silenceConsoleAndStdout(): () => void {\n const CONSOLE_METHODS = ['log', 'warn', 'error', 'info', 'debug'] as const;\n const originalConsole = Object.fromEntries(\n // eslint-disable-next-line no-console\n CONSOLE_METHODS.map((m) => [m, console[m]])\n ) as Record<(typeof CONSOLE_METHODS)[number], (...args: any[]) => void>;\n const originalStdoutWrite = process.stdout.write.bind(process.stdout);\n const originalStderrWrite = process.stderr.write.bind(process.stderr);\n\n for (const method of CONSOLE_METHODS) {\n // eslint-disable-next-line no-console\n console[method] = () => {};\n }\n\n // process.stdout.write(chunk, encoding?, callback?) — callers may rely on the optional\n // callback firing. Invoke it so we don't leave writers hanging.\n const stubWrite = (...args: any[]): boolean => {\n const cb = args.find((a) => typeof a === 'function') as ((err?: Error | null) => void) | undefined;\n if (cb) cb();\n return true;\n };\n process.stdout.write = stubWrite as typeof process.stdout.write;\n process.stderr.write = stubWrite as typeof process.stderr.write;\n\n return () => {\n for (const method of CONSOLE_METHODS) {\n // eslint-disable-next-line no-console\n console[method] = originalConsole[method];\n }\n process.stdout.write = originalStdoutWrite;\n process.stderr.write = originalStderrWrite;\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,aAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAA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OAAO,CAAC6C,CAAC,CAAC,CAAC,CAC5C,CAAuE;EACvE,MAAMC,mBAAmB,GAAGpC,OAAO,CAACqC,MAAM,CAACC,KAAK,CAACC,IAAI,CAACvC,OAAO,CAACqC,MAAM,CAAC;EACrE,MAAMG,mBAAmB,GAAGxC,OAAO,CAACyC,MAAM,CAACH,KAAK,CAACC,IAAI,CAACvC,OAAO,CAACyC,MAAM,CAAC;EAErE,KAAK,MAAMC,MAAM,IAAIV,eAAe,EAAE;IACpC;IACA1C,OAAO,CAACoD,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;EAC5B;;EAEA;EACA;EACA,MAAMC,SAAS,GAAGA,CAAC,GAAGC,IAAW,KAAc;IAC7C,MAAMC,EAAE,GAAGD,IAAI,CAACE,IAAI,CAAEC,CAAC,IAAK,OAAOA,CAAC,KAAK,UAAU,CAA+C;IAClG,IAAIF,EAAE,EAAEA,EAAE,CAAC,CAAC;IACZ,OAAO,IAAI;EACb,CAAC;EACD7C,OAAO,CAACqC,MAAM,CAACC,KAAK,GAAGK,SAAwC;EAC/D3C,OAAO,CAACyC,MAAM,CAACH,KAAK,GAAGK,SAAwC;EAE/D,OAAO,MAAM;IACX,KAAK,MAAMD,MAAM,IAAIV,eAAe,EAAE;MACpC;MACA1C,OAAO,CAACoD,MAAM,CAAC,GAAGT,eAAe,CAACS,MAAM,CAAC;IAC3C;IACA1C,OAAO,CAACqC,MAAM,CAACC,KAAK,GAAGF,mBAAmB;IAC1CpC,OAAO,CAACyC,MAAM,CAACH,KAAK,GAAGE,mBAAmB;EAC5C,CAAC;AACH","ignoreList":[]}
|
package/dist/tester.service.js
CHANGED
|
@@ -97,16 +97,15 @@ class TesterService {
|
|
|
97
97
|
return new (_tester().Tests)([]);
|
|
98
98
|
}
|
|
99
99
|
const tester = context.env.getTester();
|
|
100
|
-
const
|
|
100
|
+
const allSpecFiles = _component().ComponentMap.as(context.components, component => {
|
|
101
101
|
return (0, _utils().detectTestFiles)(component, this.devFiles);
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.logger.consoleWarning(`no tests found for components using environment ${chalk.cyan(context.id)}\n`);
|
|
103
|
+
// drop components with zero spec files before handing them to the tester — otherwise testers
|
|
104
|
+
// like Mocha invoke their reporter once per component and print "0 passing (0ms)" noise.
|
|
105
|
+
const specFiles = allSpecFiles.filter(files => files.length > 0);
|
|
106
|
+
const componentWithTests = specFiles.toArray().length;
|
|
107
|
+
if (componentWithTests === 0 && !options.ui) {
|
|
108
|
+
// silent: the final summary in `bit test` collapses no-test components into a single line.
|
|
110
109
|
return new (_tester().Tests)([]);
|
|
111
110
|
}
|
|
112
111
|
if (!options.ui) this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_path","data","require","_component","_cliHighlight","_interopRequireDefault","_tester","_tester2","_utils","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","chalk","OnTestsChanged","exports","TesterService","constructor","workspace","logger","pubsub","devFiles","render","env","descriptor","getDescriptor","name","green","id","displayName","version","configLabel","configObj","config","highlight","language","ignoreIllegals","environment","getTester","undefined","tester","icon","displayConfig","transform","context","onTestRunComplete","callback","_callback","run","options","Tests","specFiles","ComponentMap","as","components","component","detectTestFiles","testCount","toArray","reduce","acc","specs","length","componentWithTests","ui","consoleWarning","cyan","console","patterns","asAsync","componentDir","componentPatterns","getDevPatterns","TesterAspect","packageRootDir","getComponentPackagePath","paths","map","pattern","path","resolve","relative","additionalHostDependencies","getAdditionalTestHostDependencies","testerContext","assign","release","sourcePatterns","rootPath","debug","watch","coverage","updateSnapshot","results","forEach","publish","testsChanged","componentId","toString","testsResults","loading","test"],"sources":["tester.service.ts"],"sourcesContent":["import type { Logger } from '@teambit/logger';\nimport { resolve } from 'path';\nimport type {\n EnvService,\n ExecutionContext,\n EnvDefinition,\n Env,\n EnvContext,\n ServiceTransformationMap,\n} from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport type { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport type { PubSubEngine } from 'graphql-subscriptions';\nimport type { DevFilesMain } from '@teambit/dev-files';\nimport type { Tester, CallbackFn } from './tester';\nimport { Tests } from './tester';\nimport { TesterAspect } from './tester.aspect';\nimport type { TesterOptions } from './tester.main.runtime';\nimport { detectTestFiles } from './utils';\n\nconst chalk = require('chalk');\n\nexport const OnTestsChanged = 'OnTestsChanged';\n\ntype TesterTransformationMap = ServiceTransformationMap & {\n getTester: () => Tester;\n};\n\nexport type TesterDescriptor = {\n /**\n * id of the tester (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the tester (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured tester.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class TesterService implements EnvService<Tests, TesterDescriptor> {\n name = 'tester';\n\n constructor(\n readonly workspace: Workspace,\n\n private logger: Logger,\n\n private pubsub: PubSubEngine,\n\n private devFiles: DevFilesMain\n ) {}\n\n _callback: CallbackFn | undefined;\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n const name = `${chalk.green('configured tester:')} ${descriptor?.id} (${descriptor?.displayName} @ ${\n descriptor?.version\n })`;\n const configLabel = chalk.green('tester config:');\n const configObj = descriptor?.config\n ? highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })\n : '';\n return `${name}\\n${configLabel}\\n${configObj}`;\n }\n\n getDescriptor(environment: EnvDefinition) {\n if (!environment.env.getTester) return undefined;\n const tester: Tester = environment.env.getTester();\n\n return {\n id: tester.id || '',\n displayName: tester.displayName || '',\n icon: tester.icon || '',\n config: tester.displayConfig ? tester.displayConfig() : '',\n version: tester.version ? tester.version() : '?',\n };\n }\n\n transform(env: Env, context: EnvContext): TesterTransformationMap | undefined {\n // Old env\n if (!env?.tester) return undefined;\n\n return {\n getTester: () => env.tester()(context),\n };\n }\n\n onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async run(context: ExecutionContext, options: TesterOptions): Promise<Tests> {\n if (!context.env.getTester) {\n return new Tests([]);\n }\n const tester: Tester = context.env.getTester();\n const specFiles = ComponentMap.as(context.components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n const testCount = specFiles.toArray().reduce((acc, [, specs]) => acc + specs.length, 0);\n\n const componentWithTests = specFiles.toArray().reduce((acc: number, [, specs]) => {\n if (specs.length > 0) acc += 1;\n return acc;\n }, 0);\n\n if (testCount === 0 && !options.ui) {\n this.logger.consoleWarning(`no tests found for components using environment ${chalk.cyan(context.id)}\\n`);\n return new Tests([]);\n }\n\n if (!options.ui)\n this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\\n`);\n\n const patterns = await ComponentMap.asAsync(context.components, async (component) => {\n const componentDir = this.workspace.componentDir(component.id);\n const componentPatterns = this.devFiles.getDevPatterns(component, TesterAspect.id);\n const packageRootDir = await this.workspace.getComponentPackagePath(component);\n\n return {\n componentDir,\n packageRootDir,\n paths:\n componentPatterns.map((pattern: string) => ({\n path: resolve(componentDir, pattern),\n relative: pattern,\n })) || [],\n };\n });\n\n let additionalHostDependencies = [];\n if (\n context.env.getAdditionalTestHostDependencies &&\n typeof context.env.getAdditionalTestHostDependencies === 'function'\n ) {\n additionalHostDependencies = await context.env.getAdditionalTestHostDependencies();\n }\n\n const testerContext = Object.assign(context, {\n release: false,\n specFiles,\n patterns,\n sourcePatterns: patterns,\n rootPath: this.workspace.path,\n workspace: this.workspace,\n debug: options.debug,\n watch: options.watch,\n ui: options.ui,\n coverage: options.coverage,\n updateSnapshot: options.updateSnapshot,\n additionalHostDependencies,\n });\n\n if (options.watch && options.ui && tester.watch) {\n if (tester.onTestRunComplete) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tester.onTestRunComplete((results) => {\n if (this._callback) this._callback(results);\n results.components.forEach((component) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.pubsub.publish(OnTestsChanged, {\n testsChanged: {\n id: component.componentId.toString(),\n testsResults: component.results,\n loading: component.loading,\n },\n });\n });\n });\n }\n\n return tester.watch(testerContext);\n }\n\n const results = await tester.test(testerContext);\n\n return results;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0C,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAA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,QAAQ,EAAE1C,OAAO,CAAC0C,QAAQ;MAC1BC,cAAc,EAAE3C,OAAO,CAAC2C,cAAc;MACtCV;IACF,CAAC,CAAC;IAEF,IAAIjC,OAAO,CAACyC,KAAK,IAAIzC,OAAO,CAACe,EAAE,IAAIxB,MAAM,CAACkD,KAAK,EAAE;MAC/C,IAAIlD,MAAM,CAACK,iBAAiB,EAAE;QAC5B;QACAL,MAAM,CAACK,iBAAiB,CAAEgD,OAAO,IAAK;UACpC,IAAI,IAAI,CAAC9C,SAAS,EAAE,IAAI,CAACA,SAAS,CAAC8C,OAAO,CAAC;UAC3CA,OAAO,CAACvC,UAAU,CAACwC,OAAO,CAAEvC,SAAS,IAAK;YACxC;YACA,IAAI,CAACnC,MAAM,CAAC2E,OAAO,CAACjF,cAAc,EAAE;cAClCkF,YAAY,EAAE;gBACZpE,EAAE,EAAE2B,SAAS,CAAC0C,WAAW,CAACC,QAAQ,CAAC,CAAC;gBACpCC,YAAY,EAAE5C,SAAS,CAACsC,OAAO;gBAC/BO,OAAO,EAAE7C,SAAS,CAAC6C;cACrB;YACF,CAAC,CAAC;UACJ,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;MAEA,OAAO5D,MAAM,CAACkD,KAAK,CAACN,aAAa,CAAC;IACpC;IAEA,MAAMS,OAAO,GAAG,MAAMrD,MAAM,CAAC6D,IAAI,CAACjB,aAAa,CAAC;IAEhD,OAAOS,OAAO;EAChB;AACF;AAAC9E,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_path","data","require","_component","_cliHighlight","_interopRequireDefault","_tester","_tester2","_utils","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","chalk","OnTestsChanged","exports","TesterService","constructor","workspace","logger","pubsub","devFiles","render","env","descriptor","getDescriptor","name","green","id","displayName","version","configLabel","configObj","config","highlight","language","ignoreIllegals","environment","getTester","undefined","tester","icon","displayConfig","transform","context","onTestRunComplete","callback","_callback","run","options","Tests","allSpecFiles","ComponentMap","as","components","component","detectTestFiles","specFiles","filter","files","length","componentWithTests","toArray","ui","console","cyan","patterns","asAsync","componentDir","componentPatterns","getDevPatterns","TesterAspect","packageRootDir","getComponentPackagePath","paths","map","pattern","path","resolve","relative","additionalHostDependencies","getAdditionalTestHostDependencies","testerContext","assign","release","sourcePatterns","rootPath","debug","watch","coverage","updateSnapshot","results","forEach","publish","testsChanged","componentId","toString","testsResults","loading","test"],"sources":["tester.service.ts"],"sourcesContent":["import type { Logger } from '@teambit/logger';\nimport { resolve } from 'path';\nimport type {\n EnvService,\n ExecutionContext,\n EnvDefinition,\n Env,\n EnvContext,\n ServiceTransformationMap,\n} from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport type { Workspace } from '@teambit/workspace';\nimport highlight from 'cli-highlight';\nimport type { PubSubEngine } from 'graphql-subscriptions';\nimport type { DevFilesMain } from '@teambit/dev-files';\nimport type { Tester, CallbackFn } from './tester';\nimport { Tests } from './tester';\nimport { TesterAspect } from './tester.aspect';\nimport type { TesterOptions } from './tester.main.runtime';\nimport { detectTestFiles } from './utils';\n\nconst chalk = require('chalk');\n\nexport const OnTestsChanged = 'OnTestsChanged';\n\ntype TesterTransformationMap = ServiceTransformationMap & {\n getTester: () => Tester;\n};\n\nexport type TesterDescriptor = {\n /**\n * id of the tester (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the tester (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured tester.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class TesterService implements EnvService<Tests, TesterDescriptor> {\n name = 'tester';\n\n constructor(\n readonly workspace: Workspace,\n\n private logger: Logger,\n\n private pubsub: PubSubEngine,\n\n private devFiles: DevFilesMain\n ) {}\n\n _callback: CallbackFn | undefined;\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n const name = `${chalk.green('configured tester:')} ${descriptor?.id} (${descriptor?.displayName} @ ${\n descriptor?.version\n })`;\n const configLabel = chalk.green('tester config:');\n const configObj = descriptor?.config\n ? highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })\n : '';\n return `${name}\\n${configLabel}\\n${configObj}`;\n }\n\n getDescriptor(environment: EnvDefinition) {\n if (!environment.env.getTester) return undefined;\n const tester: Tester = environment.env.getTester();\n\n return {\n id: tester.id || '',\n displayName: tester.displayName || '',\n icon: tester.icon || '',\n config: tester.displayConfig ? tester.displayConfig() : '',\n version: tester.version ? tester.version() : '?',\n };\n }\n\n transform(env: Env, context: EnvContext): TesterTransformationMap | undefined {\n // Old env\n if (!env?.tester) return undefined;\n\n return {\n getTester: () => env.tester()(context),\n };\n }\n\n onTestRunComplete(callback: CallbackFn) {\n this._callback = callback;\n }\n\n async run(context: ExecutionContext, options: TesterOptions): Promise<Tests> {\n if (!context.env.getTester) {\n return new Tests([]);\n }\n const tester: Tester = context.env.getTester();\n const allSpecFiles = ComponentMap.as(context.components, (component) => {\n return detectTestFiles(component, this.devFiles);\n });\n // drop components with zero spec files before handing them to the tester — otherwise testers\n // like Mocha invoke their reporter once per component and print \"0 passing (0ms)\" noise.\n const specFiles = allSpecFiles.filter((files) => files.length > 0);\n const componentWithTests = specFiles.toArray().length;\n\n if (componentWithTests === 0 && !options.ui) {\n // silent: the final summary in `bit test` collapses no-test components into a single line.\n return new Tests([]);\n }\n\n if (!options.ui)\n this.logger.console(`testing ${componentWithTests} components with environment ${chalk.cyan(context.id)}\\n`);\n\n const patterns = await ComponentMap.asAsync(context.components, async (component) => {\n const componentDir = this.workspace.componentDir(component.id);\n const componentPatterns = this.devFiles.getDevPatterns(component, TesterAspect.id);\n const packageRootDir = await this.workspace.getComponentPackagePath(component);\n\n return {\n componentDir,\n packageRootDir,\n paths:\n componentPatterns.map((pattern: string) => ({\n path: resolve(componentDir, pattern),\n relative: pattern,\n })) || [],\n };\n });\n\n let additionalHostDependencies = [];\n if (\n context.env.getAdditionalTestHostDependencies &&\n typeof context.env.getAdditionalTestHostDependencies === 'function'\n ) {\n additionalHostDependencies = await context.env.getAdditionalTestHostDependencies();\n }\n\n const testerContext = Object.assign(context, {\n release: false,\n specFiles,\n patterns,\n sourcePatterns: patterns,\n rootPath: this.workspace.path,\n workspace: this.workspace,\n debug: options.debug,\n watch: options.watch,\n ui: options.ui,\n coverage: options.coverage,\n updateSnapshot: options.updateSnapshot,\n additionalHostDependencies,\n });\n\n if (options.watch && options.ui && tester.watch) {\n if (tester.onTestRunComplete) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tester.onTestRunComplete((results) => {\n if (this._callback) this._callback(results);\n results.components.forEach((component) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.pubsub.publish(OnTestsChanged, {\n testsChanged: {\n id: component.componentId.toString(),\n testsResults: component.results,\n loading: component.loading,\n },\n });\n });\n });\n }\n\n return tester.watch(testerContext);\n }\n\n const results = await tester.test(testerContext);\n\n return results;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,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BzB,EAAE,EAAEd,OAAO,CAACc,EAAE;MACd0B,QAAQ,EAAExC,OAAO,CAACwC,QAAQ;MAC1BC,cAAc,EAAEzC,OAAO,CAACyC,cAAc;MACtCV;IACF,CAAC,CAAC;IAEF,IAAI/B,OAAO,CAACuC,KAAK,IAAIvC,OAAO,CAACc,EAAE,IAAIvB,MAAM,CAACgD,KAAK,EAAE;MAC/C,IAAIhD,MAAM,CAACK,iBAAiB,EAAE;QAC5B;QACAL,MAAM,CAACK,iBAAiB,CAAE8C,OAAO,IAAK;UACpC,IAAI,IAAI,CAAC5C,SAAS,EAAE,IAAI,CAACA,SAAS,CAAC4C,OAAO,CAAC;UAC3CA,OAAO,CAACrC,UAAU,CAACsC,OAAO,CAAErC,SAAS,IAAK;YACxC;YACA,IAAI,CAACnC,MAAM,CAACyE,OAAO,CAAC/E,cAAc,EAAE;cAClCgF,YAAY,EAAE;gBACZlE,EAAE,EAAE2B,SAAS,CAACwC,WAAW,CAACC,QAAQ,CAAC,CAAC;gBACpCC,YAAY,EAAE1C,SAAS,CAACoC,OAAO;gBAC/BO,OAAO,EAAE3C,SAAS,CAAC2C;cACrB;YACF,CAAC,CAAC;UACJ,CAAC,CAAC;QACJ,CAAC,CAAC;MACJ;MAEA,OAAO1D,MAAM,CAACgD,KAAK,CAACN,aAAa,CAAC;IACpC;IAEA,MAAMS,OAAO,GAAG,MAAMnD,MAAM,CAAC2D,IAAI,CAACjB,aAAa,CAAC;IAEhD,OAAOS,OAAO;EAChB;AACF;AAAC5E,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/tester",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.960",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/tester",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "tester",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.960"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"lodash": "4.17.21",
|
|
12
13
|
"chalk": "4.1.2",
|
|
13
14
|
"graphql-subscriptions": "1.2.0",
|
|
14
15
|
"graphql-tag": "2.12.1",
|
|
15
16
|
"fs-extra": "10.0.0",
|
|
16
17
|
"lodash.compact": "3.0.1",
|
|
17
|
-
"lodash": "4.17.21",
|
|
18
18
|
"cli-highlight": "2.1.9",
|
|
19
19
|
"junit-report-builder": "3.0.1",
|
|
20
20
|
"strip-ansi": "6.0.0",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
"@teambit/defender.ui.test-compare-section": "0.0.102",
|
|
34
34
|
"@teambit/defender.ui.test-page": "0.0.82",
|
|
35
35
|
"@teambit/bit-error": "0.0.404",
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
39
|
-
"@teambit/graphql": "1.0.
|
|
40
|
-
"@teambit/builder": "1.0.
|
|
41
|
-
"@teambit/dev-files": "1.0.
|
|
42
|
-
"@teambit/ui": "1.0.
|
|
43
|
-
"@teambit/compiler": "1.0.
|
|
44
|
-
"@teambit/component-compare": "1.0.
|
|
45
|
-
"@teambit/docs": "1.0.
|
|
36
|
+
"@teambit/component": "1.0.960",
|
|
37
|
+
"@teambit/workspace": "1.0.960",
|
|
38
|
+
"@teambit/envs": "1.0.960",
|
|
39
|
+
"@teambit/graphql": "1.0.960",
|
|
40
|
+
"@teambit/builder": "1.0.960",
|
|
41
|
+
"@teambit/dev-files": "1.0.960",
|
|
42
|
+
"@teambit/ui": "1.0.960",
|
|
43
|
+
"@teambit/compiler": "1.0.960",
|
|
44
|
+
"@teambit/component-compare": "1.0.960",
|
|
45
|
+
"@teambit/docs": "1.0.960"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@types/lodash": "4.14.165",
|
|
48
49
|
"@types/fs-extra": "9.0.7",
|
|
49
50
|
"@types/lodash.compact": "3.0.6",
|
|
50
|
-
"@types/lodash": "4.14.165",
|
|
51
51
|
"@types/mocha": "9.1.0",
|
|
52
52
|
"@teambit/defender.content.tester-overview": "1.96.11",
|
|
53
53
|
"@teambit/harmony.envs.core-aspect-env": "0.1.4"
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@apollo/client": "^3.6.0",
|
|
57
57
|
"react": "^17.0.0 || ^18.0.0",
|
|
58
|
+
"chai": "5.2.1",
|
|
58
59
|
"@types/react": "^17.0.73",
|
|
60
|
+
"@types/chai": "5.2.2",
|
|
59
61
|
"@teambit/base-react.navigation.link": "2.0.33"
|
|
60
62
|
},
|
|
61
63
|
"license": "Apache-2.0",
|