test: continue fixing the eslint test timeout…

This commit is contained in:
Haoqun Jiang
2021-10-23 13:45:23 +08:00
parent 9eef87799e
commit 23f8c6a355

View File

@@ -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()