Skip to content

Commit

Permalink
test: continue fixing the eslint test timeout…
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Oct 23, 2021
1 parent 9eef877 commit 23f8c6a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,23 +251,21 @@ test(`should use formatter 'stylish'`, async () => {

const server = run('vue-cli-service serve')

let isFirstMsg = true
let output = ''
server.stdout.on('data', data => {
data = data.toString()
if (isFirstMsg) {
expect(data).toMatch(/Failed to compile with \d error/)
isFirstMsg = false
}
output += data.toString()
console.error('output', output)

if (data.match(/semi/)) {
if (/webpack compiled with 1 error/.test(output)) {
expect(output).toMatch(/Failed to compile with \d error/)
// check the format of output
// https://eslint.org/docs/user-guide/formatters/#stylish
// it looks like:
// ERROR in .../packages/test/eslint-formatter-stylish/src/main.js
// 1:22 error Missing semicolon semi
expect(data).toMatch(`src${path.sep}main.js`)
expect(data).toMatch(`error`)
expect(data).toMatch(`Missing semicolon semi`)
expect(output).toMatch(`src${path.sep}main.js`)
expect(output).toMatch(`error`)
expect(output).toMatch(`Missing semicolon semi`)

server.stdin.write('close')
done()
Expand Down

0 comments on commit 23f8c6a

Please sign in to comment.