Skip to content

Commit

Permalink
Remove option-filtering options from the final options results. (#8315)
Browse files Browse the repository at this point in the history
| Q 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽  | A <!--(Can use an emoji 馃憤) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes babel/babel-loader#642
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR Link    | <!-- If only readme change, add `[skip ci]` to your commits -->
| Any Dependency Changes?  |
| License                  | MIT

Since these were getting left in, things that loaded the config, and then passed in back to Babel would get `test` and such _twice_, which could lead to either bad configuration merging, or no configuration at all if the patterns were relative to different directories, as was the case in babel/babel-loader#642.
  • Loading branch information
loganfsmyth committed Jul 13, 2018
1 parent dca6125 commit fd9ebf9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/babel-core/src/config/config-chain.js
Expand Up @@ -500,11 +500,15 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
};
delete options.extends;
delete options.env;
delete options.overrides;
delete options.plugins;
delete options.presets;
delete options.passPerPreset;
delete options.ignore;
delete options.only;
delete options.test;
delete options.include;
delete options.exclude;

// "sourceMap" is just aliased to sourceMap, so copy it over as
// we merge the options together.
Expand Down
17 changes: 17 additions & 0 deletions packages/babel-core/test/config-chain.js
Expand Up @@ -899,6 +899,23 @@ describe("buildConfigChain", function() {

expect(opts.comments).toBe(true);
});

it("should remove the overrides and filtering fields from the options", () => {
const opts = loadOptions({
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
overrides: [],
test: /^/,
include: /^/,
exclude: [],
});

expect(opts.overrides).toBeUndefined();
expect(opts.test).toBeUndefined();
expect(opts.include).toBeUndefined();
expect(opts.exclude).toBeUndefined();
});
});

describe("config files", () => {
Expand Down

0 comments on commit fd9ebf9

Please sign in to comment.