* Migrate the following packages' tests:
* babel-helper-annotate-as-pure
* babel-helper-module-imports
* babel-helper-transform-fixture-test-runner
* babel-highlight
* babel-node
* babel-plugin-transform-modules-commonjs
* babel-preset-env-standalone
* babel-preset-env
* babel-preset-es2015
* babel-preset-react
* babel-standalone
* babel-template
* babel-traverse
* babel-types
24 lines
572 B
JavaScript
24 lines
572 B
JavaScript
import { runCodeInTestContext } from "..";
|
|
|
|
describe("helper-transform-fixture-test-runner", function() {
|
|
it("should not execute code in Node's global context", function() {
|
|
try {
|
|
global.foo = "outer";
|
|
runCodeInTestContext(`
|
|
expect(global.foo).toBeUndefined();
|
|
global.foo = "inner";
|
|
`);
|
|
|
|
expect(global.foo).toBe("outer");
|
|
runCodeInTestContext(`
|
|
expect(global.foo).toBe("inner");
|
|
`);
|
|
} finally {
|
|
delete global.foo;
|
|
runCodeInTestContext(`
|
|
delete global.foo;
|
|
`);
|
|
}
|
|
});
|
|
});
|