Skip to content

Commit 17339d7

Browse files
authored
test: should not expect babel polyfill paths to be extension-less (#6106)
See babel/babel#10862
1 parent 2dbe0be commit 17339d7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/@vue/babel-preset-app/__tests__/babel-preset.spec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test('polyfill detection', () => {
2929
// default includes
3030
expect(code).not.toMatch(getAbsolutePolyfill('es.promise'))
3131
// usage-based detection
32-
expect(code).not.toMatch('"core-js/modules/es.map"')
32+
expect(code).not.toMatch('core-js/modules/es.map')
3333

3434
;({ code } = babel.transformSync(`
3535
const a = new Map()
@@ -45,7 +45,7 @@ test('polyfill detection', () => {
4545
// promise polyfill alone doesn't work in IE, needs this as well. fix: #1642
4646
expect(code).toMatch(getAbsolutePolyfill('es.array.iterator'))
4747
// usage-based detection
48-
expect(code).toMatch('"core-js/modules/es.map"')
48+
expect(code).toMatch('core-js/modules/es.map')
4949
})
5050

5151
test('modern mode always skips unnecessary polyfills', () => {
@@ -67,7 +67,7 @@ test('modern mode always skips unnecessary polyfills', () => {
6767
// (modern: safari >= 10.1, es.promise: safrai >= 11)
6868
// the custom configuration only expects to support safari >= 12
6969
// so it can be skipped
70-
expect(code).not.toMatch('es.promise"')
70+
expect(code).not.toMatch('es.promise[^.]')
7171
// es.promise.finally is supported in safari >= 13.0.3
7272
// so still needs to be included
7373
expect(code).toMatch('es.promise.finally')
@@ -89,10 +89,10 @@ test('modern mode always skips unnecessary polyfills', () => {
8989
filename: 'test-entry-file.js'
9090
}))
9191
// default includes
92-
expect(code).not.toMatch('es.promise"')
92+
expect(code).not.toMatch('es.promise[^.]')
9393
expect(code).not.toMatch('es.promise.finally')
9494
// usage-based detection
95-
expect(code).not.toMatch('"core-js/modules/es.map"')
95+
expect(code).not.toMatch('core-js/modules/es.map')
9696
expect(code).not.toMatch('es.global-this')
9797
delete process.env.VUE_CLI_MODERN_BUILD
9898
})
@@ -120,7 +120,7 @@ test('async/await', () => {
120120
`.trim(), defaultOptions)
121121
expect(code).toMatch(getAbsolutePolyfill('es.promise'))
122122
// should use regenerator runtime
123-
expect(code).toMatch(`"regenerator-runtime/runtime"`)
123+
expect(code).toMatch(`regenerator-runtime/runtime`)
124124
})
125125

126126
test('jsx', () => {
@@ -166,7 +166,7 @@ test('disable absoluteRuntime', () => {
166166
filename: 'test-entry-file.js'
167167
})
168168

169-
expect(code).toMatch('"@babel/runtime/helpers/toConsumableArray"')
169+
expect(code).toMatch('@babel/runtime/helpers/toConsumableArray')
170170
expect(code).not.toMatch(getAbsolutePolyfill('es.promise'))
171171
})
172172

@@ -187,8 +187,8 @@ test('should inject polyfills / helpers using "require" statements for a umd mod
187187
}]],
188188
filename: 'test-entry-file.js'
189189
})
190-
expect(code).toMatch('require("@babel/runtime/helpers/toConsumableArray")')
191-
expect(code).toMatch('require("core-js/modules/es.promise")')
190+
expect(code).toMatch('require("@babel/runtime/helpers/toConsumableArray')
191+
expect(code).toMatch('require("core-js/modules/es.promise')
192192
expect(code).not.toMatch('import ')
193193
})
194194

@@ -205,8 +205,8 @@ test('should inject polyfills / helpers using "import" statements for an es modu
205205
filename: 'test-entry-file.js'
206206
})
207207

208-
expect(code).toMatch('import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"')
209-
expect(code).toMatch('import "core-js/modules/es.promise"')
208+
expect(code).toMatch('import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray')
209+
expect(code).toMatch('import "core-js/modules/es.promise')
210210
expect(code).not.toMatch('require(')
211211
})
212212

0 commit comments

Comments
 (0)