Move @babel/node tests (#13037)

This commit is contained in:
Nicolò Ribaudo
2021-03-22 23:08:18 +01:00
parent 4f727139ec
commit afef4f85ff
60 changed files with 46 additions and 52 deletions

View File

@@ -0,0 +1,7 @@
module.exports = function (api) {
api.cache.forever();
console.log("Config was loaded, so --config-file was used.");
return {};
};

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,3 @@
{
"args": ["--config-file", "./configFile.js", "index"]
}

View File

@@ -0,0 +1,2 @@
Config was loaded, so --config-file was used.
foo

View File

@@ -0,0 +1,7 @@
{
"env": {
"env-name-test": {
"plugins": ["./logPlugin.js"]
}
}
}

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,4 @@
module.exports = function () {
console.log("Plugin was loaded, so --env-name matched.");
return {}
}

View File

@@ -0,0 +1,3 @@
{
"args": ["--env-name", "env-name-test", "index"]
}

View File

@@ -0,0 +1,2 @@
Plugin was loaded, so --env-name matched.
foo

View File

@@ -0,0 +1,4 @@
{
"args": ["--eval", "console.log([1, 2, 3].map(x => x * x));"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1 @@
console.log([1, 2, 3].map(x => x * x));

View File

@@ -0,0 +1,4 @@
{
"args": ["foo", "--extensions", ".bar"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1,3 @@
{
"plugins": ["./logPlugin.js"]
}

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,4 @@
module.exports = function () {
console.log("Plugin was loaded, shouldn't appear due to --no-babelrc");
return {}
}

View File

@@ -0,0 +1,3 @@
{
"args": ["--no-babelrc", "index"]
}

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,4 @@
module.exports = function () {
console.log("Preset was loaded, so --presets was used.");
return {};
};

View File

@@ -0,0 +1,3 @@
{
"args": ["--presets", "./presetFile.js", "index"]
}

View File

@@ -0,0 +1,2 @@
Preset was loaded, so --presets was used.
foo

View File

@@ -0,0 +1,4 @@
{
"args": ["--print", "--eval", "([1, 2, 3].map(x => x * x))"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1 @@
console.log("dep");

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,3 @@
{
"args": ["foo", "-r", "./dep"]
}

View File

@@ -0,0 +1,2 @@
dep
foo

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1 @@
console.log("dep");

View File

@@ -0,0 +1,3 @@
{
"args": ["foo", "-r", "dep"]
}

View File

@@ -0,0 +1,2 @@
dep
foo

View File

@@ -0,0 +1 @@
console.log("foo");

View File

@@ -0,0 +1,4 @@
module.exports = function () {
console.log("Preset was loaded, so -b was used.");
return {};
};

View File

@@ -0,0 +1,3 @@
{
"args": ["-b", "./presetFile.js", "index"]
}

View File

@@ -0,0 +1,2 @@
Preset was loaded, so -b was used.
foo

View File

@@ -0,0 +1 @@
console.log(process.argv[2]);

View File

@@ -0,0 +1,4 @@
{
"args": ["bar", "foo"],
"stdout": "foo"
}

View File

@@ -0,0 +1,2 @@
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,3 @@
{
"args": ["foo"]
}

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1,2 @@
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,3 @@
{
"args": ["bar"]
}

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1,4 @@
{
"args": ["--eval", "--print", "var a = 1;"],
"stdout": "undefined"
}

View File

@@ -0,0 +1,7 @@
const cluster = require("cluster");
console.log(typeof global.gc, cluster.isMaster);
if (cluster.isMaster) {
cluster.fork();
} else {
process.kill(process.pid);
}

View File

@@ -0,0 +1,4 @@
{
"args": ["--expose_gc", "payload.js"],
"stdout": "function true\nfunction false"
}

View File

@@ -0,0 +1,6 @@
{
"args": ["--inspect", "--eval", "console.log('foo');"],
"stderr": "Debugger listening on",
"stderrContains": true,
"stdout": "foo"
}

View File

@@ -0,0 +1,4 @@
{
"args": ["--nolazy", "--eval", "console.log('foo')"],
"stdout": "foo"
}

View File

@@ -0,0 +1,4 @@
{
"args": ["-gc", "--eval", "console.log(typeof global.gc)"],
"stdout": "function"
}

View File

@@ -0,0 +1,2 @@
var bar = () => console.log("bar");
bar();

View File

@@ -0,0 +1,5 @@
import "./bar2";
import "./not_node_modules";
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,10 @@
/*
The purpose of this file is to test that the node_modules check in the require
hook doesn't mistakenly exclude something like "not_node_modules". To pass, this
file merely needs to be transpiled. The transpiled code won't, and doesn't need
to, execute without error. It won't execute because React will be undefined.
*/
try {
<Some jsx="element" />;
}
catch (e) {}

View File

@@ -0,0 +1,3 @@
{
"args": ["foo2"]
}

View File

@@ -0,0 +1,2 @@
bar
foo

View File

@@ -0,0 +1,2 @@
process.send({ hello: "world" });
console.log("sent");

View File

@@ -0,0 +1,4 @@
{
"args": ["payload.js"],
"stdout": "sent"
}

View File

@@ -0,0 +1,8 @@
{
"args": [
"--expose-gc-as=garbageCollector",
"--eval",
"console.log(typeof global.garbageCollector)"
],
"stdout": "function"
}

View File

@@ -0,0 +1,4 @@
{
"args": ["--expose-gc", "--eval", "console.log(typeof global.gc)"],
"stdout": "function"
}

View File

@@ -0,0 +1,8 @@
{
"args": [
"--expose_gc_as=garbageCollector",
"--eval",
"console.log(typeof global.garbageCollector)"
],
"stdout": "function"
}

View File

@@ -0,0 +1,4 @@
{
"args": ["--expose_gc", "--eval", "console.log(typeof global.gc)"],
"stdout": "function"
}