From 23f8c6a35542d506b44b48dce67fcc3470cdecb9 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Sat, 23 Oct 2021 13:45:23 +0800 Subject: [PATCH] =?UTF-8?q?test:=20continue=20fixing=20the=20eslint=20test?= =?UTF-8?q?=20timeout=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/eslintPlugin.spec.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js b/packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js index 175e6e006..1daa0f2a4 100644 --- a/packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js +++ b/packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js @@ -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()