Skip to content

Commit

Permalink
Only keep assumptions used in the tests, everything else will be in o…
Browse files Browse the repository at this point in the history
…ther PRs
  • Loading branch information
nicolo-ribaudo committed Nov 27, 2020
1 parent 9aaf0da commit 985ccbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
16 changes: 0 additions & 16 deletions packages/babel-core/src/config/validation/options.js
Expand Up @@ -332,25 +332,9 @@ type EnvPath = $ReadOnly<{
export type NestingPath = RootPath | OverridesPath | EnvPath;

export const assumptionsNames = new Set<string>([
"arrayLikeIsIterable",
"arrayIndexedIteration",
"copyReexports",
"ignoreFunctionLength",
"ignoreToPrimitiveHint",
"inheritsAsObjectCreate",
"iterableIsArray",
"mutableTemplateObject",
"newableArrowFunctions",
"noDocumentAll",
"objectRestNoSymbols",
"privateFieldsAsPublic",
"setClassMethods",
"setComputedProperties",
"setModuleMeta",
"setPublicClassFields",
"setSpreadProperties",
"skipForOfIterationClosing",
"superAsFunctionCall",
]);

function getSource(loc: NestingPath): OptionsSource {
Expand Down
28 changes: 13 additions & 15 deletions packages/babel-core/test/assumptions.js
Expand Up @@ -34,11 +34,11 @@ describe("assumptions", () => {
assumptions: {
setPublicClassFields: true,
},
presets: [() => ({ assumptions: { setClassMethods: true } })],
presets: [() => ({ assumptions: { mutableTemplateObject: true } })],
}).assumptions,
).toEqual({
setPublicClassFields: true,
setClassMethods: true,
mutableTemplateObject: true,
// This is enabled by default
newableArrowFunctions: true,
});
Expand Down Expand Up @@ -110,11 +110,11 @@ describe("assumptions", () => {

run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});
run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});

expect(plugin).toHaveBeenCalledTimes(1);
Expand All @@ -125,11 +125,11 @@ describe("assumptions", () => {

run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});
run(plugin, {
setPublicClassFields: true,
setClassMethods: true,
mutableTemplateObject: true,
});

expect(plugin).toHaveBeenCalledTimes(1);
Expand All @@ -140,11 +140,11 @@ describe("assumptions", () => {

run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});
run(plugin, {
setPublicClassFields: false,
setClassMethods: true,
mutableTemplateObject: true,
});

expect(plugin).toHaveBeenCalledTimes(2);
Expand All @@ -154,13 +154,11 @@ describe("assumptions", () => {
const plugin = makePlugin();

run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});
run(plugin, {
setPublicClassFields: false,
setClassMethods: true,
mutableTemplateObject: true,
mutableTemplateObject: false,
setPublicClassFields: true,
});

expect(plugin).toHaveBeenCalledTimes(2);
Expand All @@ -171,10 +169,10 @@ describe("assumptions", () => {

run(plugin, {
setPublicClassFields: true,
setClassMethods: false,
mutableTemplateObject: false,
});
run(plugin, {
setClassMethods: true,
mutableTemplateObject: true,
});

expect(plugin).toHaveBeenCalledTimes(2);
Expand Down

0 comments on commit 985ccbf

Please sign in to comment.