Skip to content

Commit

Permalink
Revert "don't use Symbol for our promise"
Browse files Browse the repository at this point in the history
This reverts commit 48da087.
  • Loading branch information
SimenB committed Oct 20, 2018
1 parent 5f8754c commit bdc4883
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions packages/jest-util/src/install_common_globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ export default function(globalObject: Global, globals: ConfigGlobals) {
globalObject.process = createProcessObject();

// Keep a reference to "Promise", since "jasmine_light.js" needs it.
Object.defineProperty(globalObject, 'jest-promise-stay-away', {
configurable: false,
enumerable: false,
value: Promise,
writable: false,
});
globalObject[globalObject.Symbol.for('jest-native-promise')] = Promise;

// Forward some APIs.
DTRACE.forEach(dtrace => {
Expand Down
3 changes: 2 additions & 1 deletion scripts/babel-plugin-jest-native-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
// This plugin exists to make sure that we use a `Promise` that has not been messed with by user code.
// Might consider extending this to other globals as well in the future

const jestPromise = "(global['jest-promise-stay-away'] || global.Promise)";
const jestPromise =
"(global[Symbol.for('jest-native-promise')] || global.Promise)";

module.exports = () => ({
name: 'jest-native-promise',
Expand Down

0 comments on commit bdc4883

Please sign in to comment.