Skip to content

Commit 827d003

Browse files
authored
Change jest snapshotFormat (#18029)
1 parent 34cf24e commit 827d003

34 files changed

Lines changed: 415 additions & 422 deletions

File tree

jest.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const isPublishBundle = process.env.IS_PUBLISH;
55
export default {
66
runner: "jest-light-runner",
77

8-
snapshotFormat: { escapeString: true, printBasicPrototype: true },
98
coverageProvider: "v8",
109
coverageReporters: ["lcov", "text"],
1110
collectCoverageFrom: [
@@ -49,12 +48,6 @@ export default {
4948
: []),
5049
],
5150
testEnvironment: "node",
52-
transformIgnorePatterns: [
53-
"/node_modules/",
54-
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
55-
"/test/(fixtures|tmp|__data__)/",
56-
"<rootDir>/(packages|codemods|eslint)/[^/]+/lib/",
57-
],
5851
modulePathIgnorePatterns: [
5952
"/test/fixtures/",
6053
"/test/tmp/",

packages/babel-core/test/__snapshots__/option-manager.js.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is following a preset 1`] = `
44
"[BABEL] unknown file: Unknown option: .useSpread. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
55
- Maybe you meant to use
6-
\\"presets\\": [
7-
[\\"./fixtures/option-manager/babel-preset-bar\\", {
8-
\\"useSpread\\": true
6+
"presets": [
7+
["./fixtures/option-manager/babel-preset-bar", {
8+
"useSpread": true
99
}]
1010
]
1111
To be a valid preset, its name and options should be wrapped in a pair of brackets"
@@ -14,9 +14,9 @@ To be a valid preset, its name and options should be wrapped in a pair of bracke
1414
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a plugin 1`] = `
1515
"[BABEL] unknown file: .useSpread is not a valid Plugin property
1616
- Maybe you meant to use
17-
\\"plugins\\": [
18-
[\\"./fixtures/option-manager/babel-plugin-foo\\", {
19-
\\"useSpread\\": true
17+
"plugins": [
18+
["./fixtures/option-manager/babel-plugin-foo", {
19+
"useSpread": true
2020
}]
2121
]
2222
To be a valid plugin, its name and options should be wrapped in a pair of brackets"
@@ -25,9 +25,9 @@ To be a valid plugin, its name and options should be wrapped in a pair of bracke
2525
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a preset 1`] = `
2626
"[BABEL] unknown file: Unknown option: .useBuiltIns. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
2727
- Maybe you meant to use
28-
\\"presets\\": [
29-
[\\"./fixtures/option-manager/babel-preset-bar\\", {
30-
\\"useBuiltIns\\": \\"entry\\"
28+
"presets": [
29+
["./fixtures/option-manager/babel-preset-bar", {
30+
"useBuiltIns": "entry"
3131
}]
3232
]
3333
To be a valid preset, its name and options should be wrapped in a pair of brackets"

packages/babel-core/test/api.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ describe("api", function () {
879879
"(function (global) {
880880
var babelHelpers = global.babelHelpers = {};
881881
function _get() {
882-
return babelHelpers.get = _get = \\"undefined\\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
882+
return babelHelpers.get = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
883883
var p = babelHelpers.superPropBase(e, t);
884884
if (p) {
885885
var n = Object.getOwnPropertyDescriptor(p, t);
@@ -888,25 +888,25 @@ describe("api", function () {
888888
}, _get.apply(null, arguments);
889889
}
890890
babelHelpers.get = _get;
891-
})(typeof global === \\"undefined\\" ? self : global);"
891+
})(typeof global === "undefined" ? self : global);"
892892
`);
893893
});
894894

895895
it("umd", function () {
896896
const script = babel.buildExternalHelpers(["get"], "umd");
897897
expect(script).toMatchInlineSnapshot(`
898898
"(function (root, factory) {
899-
if (typeof define === \\"function\\" && define.amd) {
900-
define([\\"exports\\"], factory);
901-
} else if (typeof exports === \\"object\\") {
899+
if (typeof define === "function" && define.amd) {
900+
define(["exports"], factory);
901+
} else if (typeof exports === "object") {
902902
factory(exports);
903903
} else {
904904
factory(root.babelHelpers = {});
905905
}
906906
})(this, function (global) {
907907
var babelHelpers = global;
908908
function _get() {
909-
return babelHelpers.get = _get = \\"undefined\\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
909+
return babelHelpers.get = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
910910
var p = babelHelpers.superPropBase(e, t);
911911
if (p) {
912912
var n = Object.getOwnPropertyDescriptor(p, t);
@@ -924,7 +924,7 @@ describe("api", function () {
924924
expect(script).toMatchInlineSnapshot(`
925925
"var babelHelpers = {};
926926
function _get() {
927-
return babelHelpers.get = _get = \\"undefined\\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
927+
return babelHelpers.get = _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
928928
var p = babelHelpers.superPropBase(e, t);
929929
if (p) {
930930
var n = Object.getOwnPropertyDescriptor(p, t);
@@ -942,7 +942,7 @@ describe("api", function () {
942942
expect(script).toMatchInlineSnapshot(`
943943
"export { _get as get };
944944
function _get() {
945-
return _get = \\"undefined\\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
945+
return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
946946
var p = _superPropBase(e, t);
947947
if (p) {
948948
var n = Object.getOwnPropertyDescriptor(p, t);

packages/babel-core/test/assumptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ describe("assumptions", () => {
152152
});
153153

154154
expect(code).toMatchInlineSnapshot(`
155-
"\\"use strict\\";
155+
""use strict";
156156
157157
exports.__esModule = true;
158158
exports.foo = void 0;

packages/babel-core/test/config-ts-integration-ts-node.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ describe("@babel/core config ts-node integration", () => {
162162
});
163163

164164
expect(config.options.targets).toMatchInlineSnapshot(`
165-
Object {
166-
"node": "12.0.0",
167-
}
168-
`);
165+
{
166+
"node": "12.0.0",
167+
}
168+
`);
169169

170170
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
171171
});

packages/babel-core/test/config-ts-integration-tsx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const shouldSkip = semver.lt(process.version, "18.0.0");
5858
});
5959

6060
expect(config.options.targets).toMatchInlineSnapshot(`
61-
Object {
61+
{
6262
"node": "12.0.0",
6363
}
6464
`);

packages/babel-core/test/config-ts.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ describe("@babel/core config with ts", () => {
1111
});
1212

1313
expect(config.options.targets).toMatchInlineSnapshot(`
14-
Object {
15-
"node": "12.0.0",
16-
}
17-
`);
14+
{
15+
"node": "12.0.0",
16+
}
17+
`);
1818

1919
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
2020
});
@@ -28,7 +28,7 @@ describe("@babel/core config with ts", () => {
2828
});
2929

3030
expect(config.options.targets).toMatchInlineSnapshot(`
31-
Object {
31+
{
3232
"node": "12.0.0",
3333
}
3434
`);
@@ -53,10 +53,10 @@ describe("@babel/core config with ts", () => {
5353
});
5454

5555
expect(config.options.targets).toMatchInlineSnapshot(`
56-
Object {
57-
"node": "12.0.0",
58-
}
59-
`);
56+
{
57+
"node": "12.0.0",
58+
}
59+
`);
6060

6161
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
6262
});
@@ -70,10 +70,10 @@ describe("@babel/core config with ts", () => {
7070
});
7171

7272
expect(config.options.targets).toMatchInlineSnapshot(`
73-
Object {
74-
"node": "12.0.0",
75-
}
76-
`);
73+
{
74+
"node": "12.0.0",
75+
}
76+
`);
7777

7878
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
7979
});
@@ -87,10 +87,10 @@ describe("@babel/core config with ts", () => {
8787
});
8888

8989
expect(config.options.targets).toMatchInlineSnapshot(`
90-
Object {
91-
"node": "12.0.0",
92-
}
93-
`);
90+
{
91+
"node": "12.0.0",
92+
}
93+
`);
9494

9595
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
9696
});
@@ -104,10 +104,10 @@ describe("@babel/core config with ts", () => {
104104
});
105105

106106
expect(config.options.targets).toMatchInlineSnapshot(`
107-
Object {
108-
"node": "12.0.0",
109-
}
110-
`);
107+
{
108+
"node": "12.0.0",
109+
}
110+
`);
111111

112112
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
113113
});
@@ -118,10 +118,10 @@ describe("@babel/core config with ts", () => {
118118
});
119119

120120
expect(config.options.targets).toMatchInlineSnapshot(`
121-
Object {
122-
"node": "12.0.0",
123-
}
124-
`);
121+
{
122+
"node": "12.0.0",
123+
}
124+
`);
125125

126126
expect(config.options.sourceRoot).toMatchInlineSnapshot(`"/a/b"`);
127127
});

packages/babel-core/test/errors-stacks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ describe("@babel/core errors", function () {
190190
root: fixture("invalid-option"),
191191
});
192192
}).toMatchInlineSnapshot(`
193-
"Error: .sourceType must be \\"module\\", \\"commonjs\\", \\"script\\", \\"unambiguous\\", or undefined
193+
"Error: .sourceType must be "module", "commonjs", "script", "unambiguous", or undefined
194194
at <CWD>/packages/babel-core/test/fixtures/errors/invalid-option/babel.config.json
195195
at Module.parseSync (<CWD>/packages/babel-core/src/parse.ts:_:_)
196196
at <CWD>/packages/babel-core/test/errors-stacks.js:_:_
@@ -207,7 +207,7 @@ describe("@babel/core errors", function () {
207207
sourceType: "foo",
208208
}),
209209
).toMatchInlineSnapshot(`
210-
"Error: .sourceType must be \\"module\\", \\"commonjs\\", \\"script\\", \\"unambiguous\\", or undefined
210+
"Error: .sourceType must be "module", "commonjs", "script", "unambiguous", or undefined
211211
at Module.parseSync (<CWD>/packages/babel-core/src/parse.ts:_:_)
212212
at <CWD>/packages/babel-core/test/errors-stacks.js:_:_
213213
at expectError (<CWD>/packages/babel-core/test/errors-stacks.js:_:_)

0 commit comments

Comments
 (0)