Skip to content

Commit e4d685d

Browse files
committed
test: add test for no .babelrc
1 parent ba46b9f commit e4d685d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/Babel.spec.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@ import Vue from 'vue'
22
import Basic from './resources/Basic.vue'
33
import jestVue from '../jest-vue'
44
import { resolve } from 'path'
5-
import { readFileSync, writeFileSync } from 'fs'
5+
import {
6+
readFileSync,
7+
writeFileSync,
8+
renameSync
9+
} from 'fs'
610

711
test('processes .vue files', () => {
812
const vm = new Vue(Basic).$mount()
913
expect(typeof vm.$el).toBe('object')
1014
})
1115

16+
test('processes .vue files with default babel if there is no .babelrc', () => {
17+
const babelRcPath = resolve(__dirname, '../.babelrc')
18+
const tempPath = resolve(__dirname, '../.renamed')
19+
renameSync(babelRcPath, tempPath)
20+
const vm = new Vue(Basic).$mount()
21+
expect(typeof vm.$el).toBe('object')
22+
renameSync(tempPath, babelRcPath)
23+
})
24+
1225
test('processes .vue files using .babelrc if it exists in route', () => {
1326
const babelRcPath = resolve(__dirname, '../.babelrc')
1427
const babelRcOriginal = readFileSync(babelRcPath, { encoding: 'utf8' })

0 commit comments

Comments
 (0)