Skip to content

Commit

Permalink
Add testPath to suite in jest-jasmine2 reporter callbacks (#5394)
Browse files Browse the repository at this point in the history
* Add testPath to suite

* Add getTestPath to suiteFactory

* Add getTestPath to topSuite
  • Loading branch information
Vanuan authored and cpojer committed Feb 9, 2018
1 parent 7c398db commit a87514a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/jest-jasmine2/src/jasmine/Env.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default function(j$) {
const realClearTimeout = global.clearTimeout;

const runnableResources = {};

let currentSpec = null;
const currentlyExecutingSuites = [];
let currentDeclarationSuite = null;
Expand Down Expand Up @@ -173,6 +172,9 @@ export default function(j$) {

const topSuite = new j$.Suite({
id: getNextSuiteId(),
getTestPath() {
return j$.testPath;
},
});
defaultResourcesForRunnable(topSuite.id);
currentDeclarationSuite = topSuite;
Expand Down Expand Up @@ -291,6 +293,9 @@ export default function(j$) {
description,
parentSuite: currentDeclarationSuite,
throwOnExpectationFailure,
getTestPath() {
return j$.testPath;
},
});

return suite;
Expand Down
1 change: 1 addition & 0 deletions packages/jest-jasmine2/src/jasmine/Suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default function Suite(attrs: Object) {
description: this.description,
fullName: this.getFullName(),
failedExpectations: [],
testPath: attrs.getTestPath(),
};
}

Expand Down

0 comments on commit a87514a

Please sign in to comment.