@react-native-harness/jest 1.4.0-rc.1 → 1.4.0
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/__tests__/bridge.test.js +6 -2
- package/dist/__tests__/crash-monitor.test.js +64 -0
- package/dist/__tests__/environment-reset.test.d.ts +2 -0
- package/dist/__tests__/environment-reset.test.d.ts.map +1 -0
- package/dist/__tests__/environment-reset.test.js +238 -0
- package/dist/__tests__/execute-run.test.js +250 -4
- package/dist/__tests__/format-harness-error.test.d.ts +2 -0
- package/dist/__tests__/format-harness-error.test.d.ts.map +1 -0
- package/dist/__tests__/format-harness-error.test.js +27 -0
- package/dist/__tests__/harness-cache.test.js +62 -41
- package/dist/__tests__/harness-session-signal.test.d.ts +2 -0
- package/dist/__tests__/harness-session-signal.test.d.ts.map +1 -0
- package/dist/__tests__/harness-session-signal.test.js +298 -0
- package/dist/__tests__/harness-session.test.js +161 -2
- package/dist/__tests__/index.test.js +3 -1
- package/dist/__tests__/metro-port.test.js +2 -0
- package/dist/__tests__/run.test.d.ts +2 -0
- package/dist/__tests__/run.test.d.ts.map +1 -0
- package/dist/__tests__/run.test.js +48 -0
- package/dist/crash-monitor.d.ts +7 -0
- package/dist/crash-monitor.d.ts.map +1 -1
- package/dist/crash-monitor.js +19 -0
- package/dist/diagnostics/__tests__/derivers.test.d.ts +2 -0
- package/dist/diagnostics/__tests__/derivers.test.d.ts.map +1 -0
- package/dist/diagnostics/__tests__/derivers.test.js +248 -0
- package/dist/diagnostics/__tests__/report.test.d.ts +2 -0
- package/dist/diagnostics/__tests__/report.test.d.ts.map +1 -0
- package/dist/diagnostics/__tests__/report.test.js +97 -0
- package/dist/diagnostics/derivers.d.ts +24 -0
- package/dist/diagnostics/derivers.d.ts.map +1 -0
- package/dist/diagnostics/derivers.js +146 -0
- package/dist/diagnostics/index.d.ts +3 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +2 -0
- package/dist/diagnostics/report.d.ts +7 -0
- package/dist/diagnostics/report.d.ts.map +1 -0
- package/dist/diagnostics/report.js +84 -0
- package/dist/environment-reset.d.ts +51 -0
- package/dist/environment-reset.d.ts.map +1 -0
- package/dist/environment-reset.js +83 -0
- package/dist/execute-run.d.ts.map +1 -1
- package/dist/execute-run.js +121 -69
- package/dist/format-harness-error.d.ts +5 -0
- package/dist/format-harness-error.d.ts.map +1 -0
- package/dist/format-harness-error.js +43 -0
- package/dist/harness-session.d.ts +26 -1
- package/dist/harness-session.d.ts.map +1 -1
- package/dist/harness-session.js +260 -87
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +21 -4
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/src/__tests__/bridge.test.ts +8 -3
- package/src/__tests__/crash-monitor.test.ts +84 -0
- package/src/__tests__/environment-reset.test.ts +308 -0
- package/src/__tests__/execute-run.test.ts +327 -4
- package/src/__tests__/format-harness-error.test.ts +32 -0
- package/src/__tests__/harness-cache.test.ts +91 -0
- package/src/__tests__/harness-session.test.ts +211 -1
- package/src/__tests__/index.test.ts +3 -1
- package/src/__tests__/metro-port.test.ts +2 -0
- package/src/__tests__/run.test.ts +74 -0
- package/src/crash-monitor.ts +28 -0
- package/src/diagnostics/__tests__/derivers.test.ts +300 -0
- package/src/diagnostics/__tests__/report.test.ts +128 -0
- package/src/diagnostics/derivers.ts +170 -0
- package/src/diagnostics/index.ts +2 -0
- package/src/diagnostics/report.ts +124 -0
- package/src/environment-reset.ts +138 -0
- package/src/execute-run.ts +136 -77
- package/src/format-harness-error.ts +73 -0
- package/src/harness-session.ts +369 -131
- package/src/run.ts +23 -4
- package/tsconfig.json +3 -0
- package/tsconfig.lib.json +3 -0
package/src/run.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
import type { HarnessSession } from './harness-session.js';
|
|
9
9
|
import { formatResultsErrors } from 'jest-message-util';
|
|
10
10
|
import { toTestResult } from './toTestResult.js';
|
|
11
|
+
import { formatHarnessErrorMessage } from './format-harness-error.js';
|
|
11
12
|
|
|
12
13
|
// Helper function to flatten nested test suites into a flat array of tests with hierarchy
|
|
13
14
|
const flattenTests = (
|
|
@@ -16,6 +17,17 @@ const flattenTests = (
|
|
|
16
17
|
): Array<HarnessTestResult & { ancestorTitles: string[] }> => {
|
|
17
18
|
const tests: Array<HarnessTestResult & { ancestorTitles: string[] }> = [];
|
|
18
19
|
|
|
20
|
+
if (suiteResult.error) {
|
|
21
|
+
tests.push({
|
|
22
|
+
name: suiteResult.name,
|
|
23
|
+
status: 'failed',
|
|
24
|
+
duration: suiteResult.duration,
|
|
25
|
+
error: suiteResult.error,
|
|
26
|
+
ancestorTitles: [...ancestorTitles],
|
|
27
|
+
fullName: [...ancestorTitles, suiteResult.name].join(' '),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
// Add tests from current suite with current hierarchy
|
|
20
32
|
for (const test of suiteResult.tests) {
|
|
21
33
|
tests.push({
|
|
@@ -88,11 +100,18 @@ export const runHarnessTestFile: RunHarnessTestFile = async ({
|
|
|
88
100
|
const setupFilesAfterEnv = projectConfig.setupFilesAfterEnv?.map(
|
|
89
101
|
(setupFile) => path.relative(globalConfig.rootDir, setupFile)
|
|
90
102
|
);
|
|
103
|
+
const testTimeout =
|
|
104
|
+
session.config.testTimeout ??
|
|
105
|
+
(projectConfig as JestConfig.ProjectConfig & { testTimeout?: number })
|
|
106
|
+
.testTimeout ??
|
|
107
|
+
(globalConfig as JestConfig.GlobalConfig & { testTimeout?: number })
|
|
108
|
+
.testTimeout;
|
|
91
109
|
|
|
92
110
|
const harnessResult = await session.runTestFile(relativeTestPath, {
|
|
93
111
|
testNamePattern: globalConfig.testNamePattern,
|
|
94
112
|
setupFiles,
|
|
95
113
|
setupFilesAfterEnv,
|
|
114
|
+
testTimeout,
|
|
96
115
|
runner: session.context.platform.runner,
|
|
97
116
|
});
|
|
98
117
|
const end = Date.now();
|
|
@@ -102,14 +121,14 @@ export const runHarnessTestFile: RunHarnessTestFile = async ({
|
|
|
102
121
|
|
|
103
122
|
// Convert TestResult[] to the format expected by toTestResult
|
|
104
123
|
const tests = allTests.map((test) => {
|
|
105
|
-
const errorMessage = test.error?.message;
|
|
106
124
|
const codeFrame = test.error?.codeFrame;
|
|
125
|
+
const errorMessage = formatHarnessErrorMessage(test.error, {
|
|
126
|
+
testStartedAt: test.startedAt,
|
|
127
|
+
});
|
|
107
128
|
|
|
108
129
|
return {
|
|
109
130
|
duration: test.duration,
|
|
110
|
-
errorMessage
|
|
111
|
-
? `${errorMessage}${codeFrame ? `\n\n${codeFrame.content}` : ''}`
|
|
112
|
-
: undefined,
|
|
131
|
+
errorMessage,
|
|
113
132
|
title: test.name,
|
|
114
133
|
fullName: test.fullName,
|
|
115
134
|
status: test.status,
|
package/tsconfig.json
CHANGED