Skip to content

Commit

Permalink
feat: provide start time in the TestCaseResult Object
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulARanger committed Jun 22, 2024
1 parent 65a80ee commit 6880c54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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
2 changes: 1 addition & 1 deletion 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

0 comments on commit 6880c54

Please sign in to comment.