Skip to content

Commit

Permalink
Fully remove weak and check only in runtime (#5252)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjesun authored Jan 9, 2018
1 parent 6931b0f commit 93acfb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Fixes

* `[jest-leak-detector]` Removed the reference to `weak`. Now, parent projects
must install it by hand for the module to work.
* `[expect]` Fail test when the types of `stringContaining` and `stringMatching`
matchers do not match. ([#5069](https://github.com/facebook/jest/pull/5069))
* `[jest-cli]` Treat dumb terminals as noninteractive
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-leak-detector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"pretty-format": "^22.0.3"
},
"optionalDependencies": {
"devDependencies": {
"weak": "^1.0.1"
}
}
5 changes: 3 additions & 2 deletions packages/jest-leak-detector/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ export default class {
let weak;

try {
// eslint-disable-next-line import/no-extraneous-dependencies
weak = require('weak');
} catch (err) {
if (!err || err.code !== 'MODULE_NOT_FOUND') {
throw err;
}

throw new Error(
'The leaking detection mechanism requires the "weak" package to work. ' +
'Please make sure that you can install the native dependency on your platform.',
'The leaking detection mechanism requires the "weak" package to be installed and work. ' +
'Please install it as a dependency on your main project',
);
}

Expand Down

0 comments on commit 93acfb0

Please sign in to comment.