Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 29, 2020
1 parent df16abc commit dfa75fa
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/babel-core/test/async.js
Expand Up @@ -217,7 +217,7 @@ describe("asynchronicity", () => {
describe(".mjs files", () => {
if (process.env.IS_PUBLISH) {
it("called synchronously", async () => {
process.chdir("plugin-mjs");
process.chdir("plugin-mjs-native");

await expect(compileInSpawedProcess(false)).rejects.toThrow(
`[BABEL]: You appear to be using a native ECMAScript module plugin, which is` +
Expand All @@ -226,7 +226,7 @@ describe("asynchronicity", () => {
});

it("called asynchronously", async () => {
process.chdir("plugin-mjs");
process.chdir("plugin-mjs-native");

await expect(compileInSpawedProcess(true)).resolves.toMatchObject({
code: `"success"`,
Expand Down Expand Up @@ -300,7 +300,7 @@ describe("asynchronicity", () => {
describe(".mjs files", () => {
if (process.env.IS_PUBLISH) {
it("called synchronously", async () => {
process.chdir("preset-mjs");
process.chdir("preset-mjs-native");

await expect(compileInSpawedProcess(false)).rejects.toThrow(
`[BABEL]: You appear to be using a native ECMAScript module preset, which is` +
Expand All @@ -309,15 +309,15 @@ describe("asynchronicity", () => {
});

it("called asynchronously", async () => {
process.chdir("preset-mjs");
process.chdir("preset-mjs-native");

await expect(compileInSpawedProcess(true)).resolves.toMatchObject({
code: `"success"`,
});
});

it("must use the 'default' export", async () => {
process.chdir("preset-mjs-named-exports");
process.chdir("preset-mjs-named-exports-native");

await expect(compileInSpawedProcess(true)).rejects.toThrow(
`Unexpected falsy value: undefined`,
Expand Down
@@ -0,0 +1,3 @@
module.exports = {
plugins: ["./plugin.mjs"],
};
@@ -0,0 +1,9 @@
export default function plugin({ types: t }) {
return {
visitor: {
Program(path) {
path.pushContainer("body", t.stringLiteral("success"));
},
},
};
}
@@ -0,0 +1,3 @@
module.exports = {
presets: ["./preset.mjs"],
};
@@ -0,0 +1,9 @@
export default function plugin({ types: t }) {
return {
visitor: {
Program(path) {
path.pushContainer("body", t.stringLiteral("success"));
},
},
};
}
@@ -0,0 +1 @@
export const plugins = ["./plugin.mjs"];
@@ -0,0 +1,3 @@
module.exports = {
presets: ["./preset.mjs"],
};
@@ -0,0 +1,9 @@
export default function plugin({ types: t }) {
return {
visitor: {
Program(path) {
path.pushContainer("body", t.stringLiteral("success"));
},
},
};
}
@@ -0,0 +1,3 @@
export default () => ({
plugins: ["./plugin.mjs"]
});

0 comments on commit dfa75fa

Please sign in to comment.