/
configuration.skip-bundled.js
68 lines (67 loc) 路 2.16 KB
/
configuration.skip-bundled.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
});
});
(process.env.BABEL_8_BREAKING ? it.skip : it)(
"Babel 7 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,
}
`);
},
);
(process.env.BABEL_8_BREAKING ? it : it.skip)(
"Babel 8 default parserOpts",
() => {
const result = normalizeParserOptions({ requireConfigFile: false });
expect(result.parserOpts).toMatchInlineSnapshot(`
Object {
"allowReturnOutsideFunction": false,
"attachComment": false,
"plugins": Array [
Array [
"estree",
Object {
"classFeatures": false,
},
],
],
"ranges": true,
"tokens": true,
}
`);
},
);
});