Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some bundle test code into
tests/
(#12577)
- Loading branch information
1 parent
7d33ed5
commit e2eac0c
Showing
4 changed files
with
59 additions
and
40 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
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,14 @@ | ||
"use strict"; | ||
const vm = require("vm"); | ||
const fs = require("fs"); | ||
|
||
function createSandBox({ files }) { | ||
const source = files.map((file) => fs.readFileSync(file, "utf8")).join(";"); | ||
const sandbox = vm.createContext(); | ||
|
||
vm.runInContext(source, sandbox); | ||
|
||
return sandbox; | ||
} | ||
|
||
module.exports = createSandBox; |
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