From 270f5e4f6e254aecb7c0faafd47e443cc05da374 Mon Sep 17 00:00:00 2001 From: M4rk9696 Date: Thu, 22 Aug 2019 19:54:10 +0530 Subject: [PATCH] Rename method and add CHANGELOG Co-Authored-By: Simen Bekkhus --- CHANGELOG.md | 1 + .../src/legacy-code-todo-rewrite/jestAdapterInit.ts | 4 ++-- packages/jest-jasmine2/src/reporter.ts | 4 ++-- packages/jest-test-result/src/helpers.ts | 2 +- packages/jest-test-result/src/index.ts | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2322ac2735e..aff3ad9d7cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - `[babel-plugin-jest-hoist]` Show codeframe on static hoisting issues ([#8865](https://github.com/facebook/jest/pull/8865)) - `[jest-config]` [**BREAKING**] Set default display name color based on runner ([#8689](https://github.com/facebook/jest/pull/8689)) +- `[@jest/test-result]` Create method to create empty `TestResult` ([#8867](https://github.com/facebook/jest/pull/8867)) ### Fixes diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts index c96ec97e84ad..0b0f92095ba3 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts @@ -11,7 +11,7 @@ import { AssertionResult, Status, TestResult, - emptyTestResult, + createEmptyTestResult, } from '@jest/test-result'; import {extractExpectedAssertionsErrors, getState, setState} from 'expect'; import {formatExecError, formatResultsErrors} from 'jest-message-util'; @@ -220,7 +220,7 @@ export const runAndTransformResultsToJestFormat = async ({ dispatch({name: 'teardown'}); return { - ...emptyTestResult(), + ...createEmptyTestResult(), console: undefined, displayName: config.displayName, failureMessage, diff --git a/packages/jest-jasmine2/src/reporter.ts b/packages/jest-jasmine2/src/reporter.ts index c5164530f604..e152ba1eae37 100644 --- a/packages/jest-jasmine2/src/reporter.ts +++ b/packages/jest-jasmine2/src/reporter.ts @@ -6,7 +6,7 @@ */ import {Config} from '@jest/types'; -import {AssertionResult, TestResult, emptyTestResult} from '@jest/test-result'; +import {AssertionResult, TestResult, createEmptyTestResult} from '@jest/test-result'; import {formatResultsErrors} from 'jest-message-util'; import {SpecResult} from './jasmine/Spec'; import {SuiteResult} from './jasmine/Suite'; @@ -78,7 +78,7 @@ export default class Jasmine2Reporter implements Reporter { }); const testResult = { - ...emptyTestResult(), + ...createEmptyTestResult(), console: null, failureMessage: formatResultsErrors( testResults, diff --git a/packages/jest-test-result/src/helpers.ts b/packages/jest-test-result/src/helpers.ts index 02b042379fa5..1048e845e340 100644 --- a/packages/jest-test-result/src/helpers.ts +++ b/packages/jest-test-result/src/helpers.ts @@ -146,7 +146,7 @@ export const addResult = ( testResult.snapshot.updated; }; -export const emptyTestResult = (): TestResult => ({ +export const createEmptyTestResult = (): TestResult => ({ leaks: false, // That's legacy code, just adding it so Flow is happy. numFailingTests: 0, numPassingTests: 0, diff --git a/packages/jest-test-result/src/index.ts b/packages/jest-test-result/src/index.ts index c2312954287e..d942f144e519 100644 --- a/packages/jest-test-result/src/index.ts +++ b/packages/jest-test-result/src/index.ts @@ -9,7 +9,7 @@ export {default as formatTestResults} from './formatTestResults'; export { addResult, buildFailureTestResult, - emptyTestResult, + createEmptyTestResult, makeEmptyAggregatedTestResult, } from './helpers'; export {