From 4462e4fb7b858fd0a8ea2a8a509e193a3b97ec04 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 5 Sep 2024 23:13:09 +0200 Subject: [PATCH] Turbopack build: Update css modules tests (#69730) Removes the in-between test that relies on the order of test execution which is not needed as this can throw in beforeAll to make all relevant tests fail. --- .../css-modules/test/index.test.js | 32 ++++++++----------- test/turbopack-build-tests-manifest.json | 2 -- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/test/integration/css-modules/test/index.test.js b/test/integration/css-modules/test/index.test.js index f9bf874fb9470..4b13eaea93428 100644 --- a/test/integration/css-modules/test/index.test.js +++ b/test/integration/css-modules/test/index.test.js @@ -440,13 +440,16 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { let appPort let app - let stdout - let code beforeAll(async () => { await remove(join(appDir, '.next')) - ;({ code, stdout } = await nextBuild(appDir, [], { + const { code, stdout } = await nextBuild(appDir, [], { stdout: true, - })) + }) + + if (code !== 0) { + console.error(stdout) + throw new Error('Build failed') + } appPort = await findPort() app = await nextStart(appDir, appPort) @@ -455,11 +458,6 @@ describe('Valid Nested CSS Module Usage from within node_modules', () => { await killApp(app) }) - it('should have compiled successfully', () => { - expect(code).toBe(0) - expect(stdout).toMatch(/Compiled successfully/) - }) - it(`should've prerendered with relevant data`, async () => { const content = await renderViaHTTP(appPort, '/') const $ = cheerio.load(content) @@ -573,13 +571,16 @@ describe('CSS Module Composes Usage (External)', () => { let appPort let app - let stdout - let code beforeAll(async () => { await remove(join(appDir, '.next')) - ;({ code, stdout } = await nextBuild(appDir, [], { + console.log({ appDir }) + const { code, stdout } = await nextBuild(appDir, [], { stdout: true, - })) + }) + if (code !== 0) { + console.error(stdout) + throw new Error('Build failed') + } appPort = await findPort() app = await nextStart(appDir, appPort) }) @@ -587,11 +588,6 @@ describe('CSS Module Composes Usage (External)', () => { await killApp(app) }) - it('should have compiled successfully', () => { - expect(code).toBe(0) - expect(stdout).toMatch(/Compiled successfully/) - }) - it(`should've emitted a single CSS file`, async () => { const content = await renderViaHTTP(appPort, '/') const $ = cheerio.load(content) diff --git a/test/turbopack-build-tests-manifest.json b/test/turbopack-build-tests-manifest.json index c618271211f57..56629f1b9c6d0 100644 --- a/test/turbopack-build-tests-manifest.json +++ b/test/turbopack-build-tests-manifest.json @@ -7879,9 +7879,7 @@ "Valid CSS Module Usage from within node_modules production mode should've prerendered with relevant data" ], "failed": [ - "CSS Module Composes Usage (External) production mode should have compiled successfully", "CSS Module Composes Usage (External) production mode should've emitted a single CSS file", - "Valid Nested CSS Module Usage from within node_modules production mode should have compiled successfully", "Valid Nested CSS Module Usage from within node_modules production mode should've emitted a single CSS file", "Valid Nested CSS Module Usage from within node_modules production mode should've prerendered with relevant data" ],