From 6d40e6e09d18a78a784f9d9ae516ca3dc59b85a1 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Wed, 30 Mar 2022 17:49:28 +0200 Subject: [PATCH] fix test --- .../test/index.test.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/integration/react-streaming-and-server-components/test/index.test.js b/test/integration/react-streaming-and-server-components/test/index.test.js index 4bdd329708b9..bb52a23a2b83 100644 --- a/test/integration/react-streaming-and-server-components/test/index.test.js +++ b/test/integration/react-streaming-and-server-components/test/index.test.js @@ -241,11 +241,17 @@ const cssSuite = { } const documentSuite = { - runTests: (context) => { - it('should error when custom _document has getInitialProps method', async () => { - const res = await fetchViaHTTP(context.appPort, '/') - expect(res.status).toBe(500) - }) + runTests: (context, env) => { + if (env === 'dev') { + it('should error when custom _document has getInitialProps method', async () => { + const res = await fetchViaHTTP(context.appPort, '/') + expect(res.status).toBe(500) + }) + } else { + it('should failed building', async () => { + expect(context.code).toBe(1) + }) + } }, beforeAll: () => documentPage.write(documentWithGip), afterAll: () => documentPage.delete(), @@ -270,7 +276,7 @@ function runSuite(suiteName, env, options) { options.beforeAll?.() if (env === 'prod') { context.appPort = await findPort() - await nextBuild(context.appDir) + context.code = (await nextBuild(context.appDir)).code context.server = await nextStart(context.appDir, context.appPort) } if (env === 'dev') {