From 9edbaf4d2fa1a193888d3e8381ca663be7e41d47 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Tue, 23 Jun 2020 23:47:15 -0400 Subject: [PATCH] update tests --- .../config-devtool-dev/test/index.test.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/integration/config-devtool-dev/test/index.test.js b/test/integration/config-devtool-dev/test/index.test.js index 473769d549e37..88a9e1da5f93a 100644 --- a/test/integration/config-devtool-dev/test/index.test.js +++ b/test/integration/config-devtool-dev/test/index.test.js @@ -1,8 +1,8 @@ /* eslint-env jest */ -import { join } from 'path' -import { launchApp, findPort, killApp, waitFor } from 'next-test-utils' +import { check, findPort, killApp, launchApp } from 'next-test-utils' import { recursiveReadDir } from 'next/dist/lib/recursive-readdir' +import { join } from 'path' jest.setTimeout(1000 * 30) @@ -18,12 +18,19 @@ describe('devtool set in developmemt mode in next config', () => { stderr += msg || '' }, }) - await waitFor(1000) - await killApp(app) - expect(stderr).toMatch(/Reverting webpack devtool to /) + const found = await check( + () => stderr, + /Reverting webpack devtool to /, + false + ) + + await killApp(app) + expect(found).toBeTruthy() }) + // TODO: update test to check the error overlay correctly resolves source + // frames, which is a more robust test it('should revert to the original devtool when user set in development mode', async () => { const appPort = await findPort() const app = await launchApp(join(__dirname, '..'), appPort)