Skip to content

Commit 662b1d3

Browse files
committed
test: fix eslint test in CI environment
1 parent 0d581ad commit 662b1d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,17 @@ test('should work', async () => {
7272
let isFirstMsg = true
7373
server.stdout.on('data', data => {
7474
data = data.toString()
75-
if (data.match(/Compiled with \d warning/)) {
75+
if (isFirstMsg) {
7676
// should fail on start
77-
expect(isFirstMsg).toBe(true)
77+
expect(data).toMatch(/Compiled with \d warning/)
7878
isFirstMsg = false
79+
7980
// fix it
8081
write('src/App.vue', app)
8182
} else if (data.match(/Compiled successfully/)) {
82-
// should compile on 2nd update
83-
expect(isFirstMsg).toBe(false)
83+
// should compile on the subsequent update
84+
// (note: in CI environment this may not be the exact 2nd update,
85+
// so we use data.match as a termination condition rather than a test case)
8486
server.stdin.write('close')
8587
done()
8688
}

0 commit comments

Comments
 (0)