Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testPath to jest-jasmine2 reporter callbacks #4594

Merged
merged 1 commit into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/jest-jasmine2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ async function jasmine2(
testPath,
);
const jasmineFactory = runtime.requireInternalModule(JASMINE);
const jasmine = jasmineFactory.create();
const jasmine = jasmineFactory.create({
testPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this to Jasmine, could we instead patch the results object like we do for snapshots below on line 110?

See https://github.com/facebook/jest/pull/4594/files#diff-e4399d1682ddb42f8a43f1a917d42d87R110

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give that a shot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer so I think that code is what deals with jest reporters not with jasmine reporters. Jasmine reporters are what I'm trying to modify because currently jest reporters do not provide callbacks for when an individual test is going to be run. The lowest level offered for those are before a describe block is run.

});

const env = jasmine.getEnv();
const jasmineInterface = jasmineFactory.interface(jasmine, env);
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-jasmine2/src/jasmine/Env.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ export default function(j$) {
getSpecName(spec) {
return getSpecName(spec, suite);
},
getTestPath() {
return j$.testPath;
},
onStart: specStarted,
description,
queueRunnerFactory,
Expand Down
1 change: 1 addition & 0 deletions packages/jest-jasmine2/src/jasmine/Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default function Spec(attrs: Object) {
failedExpectations: [],
passedExpectations: [],
pendingReason: '',
testPath: attrs.getTestPath(),
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-jasmine2/src/jasmine/jasmine_light.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import SpyRegistry from './spy_registry';
import Suite from './Suite';
import Timer from './Timer';

export const create = function() {
const j$ = {};
export const create = function(createOptions: Object) {
const j$ = Object.assign({}, createOptions);

j$.DEFAULT_TIMEOUT_INTERVAL = 5000;

Expand Down