Skip to content

Commit a87514a

Browse files
Vanuancpojer
authored andcommitted
Add testPath to suite in jest-jasmine2 reporter callbacks (#5394)
* Add testPath to suite * Add getTestPath to suiteFactory * Add getTestPath to topSuite
1 parent 7c398db commit a87514a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/jest-jasmine2/src/jasmine/Env.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default function(j$) {
5252
const realClearTimeout = global.clearTimeout;
5353

5454
const runnableResources = {};
55-
5655
let currentSpec = null;
5756
const currentlyExecutingSuites = [];
5857
let currentDeclarationSuite = null;
@@ -173,6 +172,9 @@ export default function(j$) {
173172

174173
const topSuite = new j$.Suite({
175174
id: getNextSuiteId(),
175+
getTestPath() {
176+
return j$.testPath;
177+
},
176178
});
177179
defaultResourcesForRunnable(topSuite.id);
178180
currentDeclarationSuite = topSuite;
@@ -291,6 +293,9 @@ export default function(j$) {
291293
description,
292294
parentSuite: currentDeclarationSuite,
293295
throwOnExpectationFailure,
296+
getTestPath() {
297+
return j$.testPath;
298+
},
294299
});
295300

296301
return suite;

packages/jest-jasmine2/src/jasmine/Suite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default function Suite(attrs: Object) {
5454
description: this.description,
5555
fullName: this.getFullName(),
5656
failedExpectations: [],
57+
testPath: attrs.getTestPath(),
5758
};
5859
}
5960

0 commit comments

Comments
 (0)