Skip to content

Commit

Permalink
chore: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jan 10, 2020
1 parent c2fe273 commit ea3cad9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/babel-core/test/__snapshots__/option-manager.js.snap
@@ -1,5 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`option-manager config plugin/preset flattening and overriding should throw when an option is following a preset 1`] = `
"[BABEL] unknown: Unknown option: .useSpread. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
- Maybe you meant to use
\\"preset\\": [
[\\"./fixtures/option-manager/babel-preset-bar\\", {
\\"useSpread\\": true
}]
]
To be a valid preset, its name and options should be wrapped in a pair of brackets"
`;

exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a plugin 1`] = `
"[BABEL] unknown: .useSpread is not a valid Plugin property
- Maybe you meant to use
Expand Down
12 changes: 12 additions & 0 deletions packages/babel-core/test/option-manager.js
Expand Up @@ -49,6 +49,18 @@ describe("option-manager", () => {
}).toThrowErrorMatchingSnapshot();
});

it("should throw when an option is following a preset", () => {
expect(() => {
loadOptions({
presets: [
"./fixtures/option-manager/babel-plugin-foo",
"./fixtures/option-manager/babel-preset-bar",
{ useSpread: true },
],
});
}).toThrowErrorMatchingSnapshot();
});

it("should not throw when a preset string followed by valid preset object", () => {
const { plugin } = makePlugin("my-plugin");
expect(
Expand Down

0 comments on commit ea3cad9

Please sign in to comment.