Update transpile to return the opposite of exclude

This commit is contained in:
Sébastien Chopin 2018-05-14 09:21:40 +02:00 committed by GitHub
parent 13ae634c74
commit f275fc8069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ describe('basic dev', () => {
extend({ module: { rules } }, { isClient }) { extend({ module: { rules } }, { isClient }) {
if (isClient) { if (isClient) {
const babelLoader = rules.find(loader => loader.test.test('.jsx')) const babelLoader = rules.find(loader => loader.test.test('.jsx'))
transpile = babelLoader.exclude transpile = (file) => !babelLoader.exclude(file)
} }
} }
} }
@ -34,10 +34,10 @@ describe('basic dev', () => {
test('Config: build.transpile', async () => { test('Config: build.transpile', async () => {
expect(transpile('vue-test')).toBeUndefined() expect(transpile('vue-test')).toBeUndefined()
expect(transpile('node_modules/test.js')).toBe(true) expect(transpile('node_modules/test.js')).toBe(false)
expect(transpile('node_modules/vue-test')).toBe(false) expect(transpile('node_modules/vue-test')).toBe(true)
expect(transpile('node_modules/vue.test.js')).toBe(false) expect(transpile('node_modules/vue.test.js')).toBe(true)
expect(transpile('node_modules/test.vue.js')).toBe(false) expect(transpile('node_modules/test.vue.js')).toBe(true)
}) })
test('/stateless', async () => { test('/stateless', async () => {