Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass startedAt onTestCaseResult #15145

Merged
merged 8 commits into from
Jul 16, 2024
5 changes: 3 additions & 2 deletions packages/jest-circus/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import dedent from 'dedent';
import isGeneratorFn from 'is-generator-fn';
import slash = require('slash');
import StackUtils = require('stack-utils');
import type {AssertionResult, Status} from '@jest/test-result';
import type {Status, TestCaseResult} from '@jest/test-result';
import type {Circus, Global} from '@jest/types';
import {
ErrorWithStack,
Expand Down Expand Up @@ -490,7 +490,7 @@ const resolveTestCaseStartInfo = (

export const parseSingleTestResult = (
testResult: Circus.TestResult,
): AssertionResult => {
): TestCaseResult => {
let status: Status;
if (testResult.status === 'skip') {
status = 'pending';
Expand All @@ -517,6 +517,7 @@ export const parseSingleTestResult = (
location: testResult.location,
numPassingAsserts: testResult.numPassingAsserts,
retryReasons: [...testResult.retryReasons],
startedAt: testResult.startedAt,
status,
title,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-test-result/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export type Suite = {
tests: Array<AssertionResult>;
};

export type TestCaseResult = AssertionResult;
export type TestCaseResult = AssertionResult & {startedAt?: number | null};

export type TestResult = {
console?: ConsoleBuffer;
Expand Down Expand Up @@ -209,7 +209,7 @@ export type TestEvents = {
'test-file-success': [Test, TestResult];
'test-file-failure': [Test, SerializableError];
'test-case-start': [string, Circus.TestCaseStartInfo];
'test-case-result': [string, AssertionResult];
'test-case-result': [string, TestCaseResult];
};

export type TestFileEvent<T extends keyof TestEvents = keyof TestEvents> = (
Expand Down
Loading