Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure this.load waits for modules that are already loading (#4296)
- Loading branch information
1 parent
e6d70d8
commit cb1419a
Showing
3 changed files
with
41 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const assert = require('assert'); | ||
|
||
let preloadedCode; | ||
|
||
module.exports = { | ||
description: 'waits for pre-loaded modules that are currently loading', | ||
options: { | ||
plugins: [ | ||
{ | ||
name: 'test-plugin', | ||
load(id) { | ||
this.load({ id }).then(({ code }) => (preloadedCode = code)); | ||
}, | ||
buildEnd(err) { | ||
assert.strictEqual(preloadedCode, 'assert.ok(true);\n'); | ||
} | ||
} | ||
] | ||
} | ||
}; |
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 @@ | ||
assert.ok(true); |