Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: imply babelrc and configFile from requireConfigFile
- Loading branch information
Showing
2 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
eslint/babel-eslint-parser/test/worker/configuration.skip-bundled.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { normalizeParserOptions } from "../../lib/worker/configuration.cjs"; | ||
|
||
describe("normalizeParserOptions", () => { | ||
describe("requireConfigFile", () => { | ||
it("should imply 'babelrc' and 'configFile' from 'requireConfigFile'", () => { | ||
const result = normalizeParserOptions({ requireConfigFile: false }); | ||
expect(result).toHaveProperty("babelrc", false); | ||
expect(result).toHaveProperty("configFile", false); | ||
}); | ||
it("The implied result can be overriden by 'babelOptions'", () => { | ||
const result = normalizeParserOptions({ | ||
requireConfigFile: false, | ||
babelOptions: { | ||
babelrc: undefined, | ||
configFile: undefined, | ||
}, | ||
}); | ||
expect(result).toHaveProperty("babelrc", undefined); | ||
expect(result).toHaveProperty("configFile", undefined); | ||
}); | ||
}); | ||
it("default parserOpts", () => { | ||
const result = normalizeParserOptions({ requireConfigFile: false }); | ||
expect(result.parserOpts).toMatchInlineSnapshot(` | ||
Object { | ||
"allowImportExportEverywhere": false, | ||
"allowReturnOutsideFunction": true, | ||
"allowSuperOutsideMethod": true, | ||
"attachComment": false, | ||
"plugins": Array [ | ||
Array [ | ||
"estree", | ||
Object { | ||
"classFeatures": false, | ||
}, | ||
], | ||
], | ||
"ranges": true, | ||
"tokens": true, | ||
} | ||
`); | ||
}); | ||
}); |