-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: full import/require cache blast when running non-parallel watch
- Loading branch information
Showing
7 changed files
with
153 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/integration/fixtures/options/watch/dependency-with-state.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let flag = false; | ||
|
||
module.exports.getFlag = () => flag; | ||
|
||
module.exports.enableFlag = () => { | ||
flag = true; | ||
}; | ||
|
||
module.exports.disableFlag = () => { | ||
flag = false; | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/integration/fixtures/options/watch/hook-mutating-dependency.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const dependency = require('./lib/dependency-with-state'); | ||
|
||
module.exports = { | ||
mochaHooks: { | ||
beforeEach: () => { | ||
dependency.enableFlag(); | ||
} | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/integration/fixtures/options/watch/test-mutating-dependency.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const dependency = require('./lib/dependency-with-state'); | ||
|
||
it('checks and mutates dependency', () => { | ||
if (dependency.getFlag()) { | ||
throw new Error('test failed'); | ||
} | ||
// Will pass 1st run, fail on subsequent ones | ||
dependency.enableFlag(); | ||
}); |
17 changes: 17 additions & 0 deletions
17
test/integration/fixtures/options/watch/test-with-hook-mutated-dependency.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const dependency = require('./lib/dependency-with-state'); | ||
|
||
// Will fail 1st run, unless hook runs | ||
before(() => { | ||
dependency.disableFlag(); | ||
}); | ||
|
||
// Will pass 1st run, fail on subsequent ones, unless hook runs | ||
afterEach(() => { | ||
dependency.disableFlag(); | ||
}); | ||
|
||
it('hook should have mutated dependency', () => { | ||
if (!dependency.getFlag()) { | ||
throw new Error('test failed'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters