test lint on save

This commit is contained in:
Evan You
2018-01-07 11:37:43 -05:00
parent a2c6bad8ac
commit 4645ca70fc
3 changed files with 15 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
jest.setTimeout(10000)
jest.setTimeout(60000)
const path = require('path')
const create = require('@vue/cli-test-utils/createTestProject')
// const serve = require('@vue/cli-test-utils/serveWithPuppeteer')
const serve = require('@vue/cli-test-utils/serveWithPuppeteer')
const runSilently = fn => {
const log = console.log
@@ -48,5 +48,15 @@ test('should work', async () => {
// should be linted on commit
expect(await read('src/main.js')).toMatch(';')
// TODO lint-on-save
// lint-on-save
write('vue.config.js', 'module.exports = { lintOnSave: true }')
await serve(project, async ({ nextUpdate }) => {
// linted when starting up the server by eslint-loader
expect(await read('src/main.js')).toMatch(';')
write('src/main.js', updatedMain)
await nextUpdate()
await new Promise(r => setTimeout(r, 1000))
// should be linted again on save
expect(await read('src/main.js')).toMatch(';')
})
})

View File

@@ -1,4 +1,4 @@
jest.setTimeout(process.env.CI ? 60000 : 20000)
jest.setTimeout(30000)
const fs = require('fs')
const path = require('path')

View File

@@ -1,4 +1,4 @@
jest.setTimeout(process.env.CI ? 30000 : 10000)
jest.setTimeout(30000)
const { defaults } = require('@vue/cli/lib/options')
const create = require('@vue/cli-test-utils/createTestProject')