Skip to content

Commit

Permalink
test: fix eslint test in CI environment
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Nov 6, 2018
1 parent 0d581ad commit 662b1d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ test('should work', async () => {
let isFirstMsg = true
server.stdout.on('data', data => {
data = data.toString()
if (data.match(/Compiled with \d warning/)) {
if (isFirstMsg) {
// should fail on start
expect(isFirstMsg).toBe(true)
expect(data).toMatch(/Compiled with \d warning/)
isFirstMsg = false

// fix it
write('src/App.vue', app)
} else if (data.match(/Compiled successfully/)) {
// should compile on 2nd update
expect(isFirstMsg).toBe(false)
// should compile on the subsequent update
// (note: in CI environment this may not be the exact 2nd update,
// so we use data.match as a termination condition rather than a test case)
server.stdin.write('close')
done()
}
Expand Down

0 comments on commit 662b1d3

Please sign in to comment.