Skip to content

Commit

Permalink
jest-circus expect global respects noJestGlobals config
Browse files Browse the repository at this point in the history
- still adds the snapshot matchers, so they should still work if one
  were to directly import expect
  • Loading branch information
agilgur5 committed Dec 15, 2019
1 parent 131ac13 commit 5915a15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const jestAdapter = async (
.requireInternalModule(path.resolve(__dirname, './jestExpect.js'))
.default({
expand: globalConfig.expand,
noJestGlobals: !globalConfig.noJestGlobals && !config.noJestGlobals,
});

const getPrettier = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
toThrowErrorMatchingSnapshot,
} from 'jest-snapshot';

export default (config: {expand: boolean}) => {
global.expect = expect;
export default (config: {expand: boolean; noJestGlobals: boolean}) => {
if (!config.noJestGlobals) global.expect = expect;
expect.setState({
expand: config.expand,
});
Expand Down

0 comments on commit 5915a15

Please sign in to comment.