Skip to content

Commit 631ff09

Browse files
aifreedomcpojer
authored andcommitted
Include fullName in formattedAssertion (#4273)
1 parent 5ead922 commit 631ff09

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*
8+
*/
9+
10+
'use strict';
11+
12+
const formatTestResults = require('../formatTestResults');
13+
14+
describe('formatTestResults', () => {
15+
const assertion = {
16+
fullName: 'TestedModule#aMethod when some condition is met returns true',
17+
status: 'passed',
18+
title: 'returns true',
19+
};
20+
21+
const results = {
22+
testResults: [
23+
{
24+
numFailingTests: 0,
25+
perfStats: {end: 2, start: 1},
26+
testResults: [assertion],
27+
},
28+
],
29+
};
30+
31+
it('includes test full name', () => {
32+
const result = formatTestResults(results, null, null);
33+
expect(result.testResults[0].assertionResults[0].fullName).toEqual(
34+
assertion.fullName,
35+
);
36+
});
37+
});

packages/jest-util/src/format_test_results.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function formatTestAssertion(
6161
): FormattedAssertionResult {
6262
const result: FormattedAssertionResult = {
6363
failureMessages: null,
64+
fullName: assertion.fullName,
6465
status: assertion.status,
6566
title: assertion.title,
6667
};

types/TestResult.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ export type AssertionResult = {|
9494
|};
9595

9696
export type FormattedAssertionResult = {
97+
failureMessages: Array<string> | null,
98+
fullName: string,
9799
status: Status,
98100
title: string,
99-
failureMessages: Array<string> | null,
100101
};
101102

102103
export type AggregatedResultWithoutCoverage = {

0 commit comments

Comments
 (0)