Skip to content

Commit

Permalink
test(next-dev): migrate styled-jsx integration test (#55079)
Browse files Browse the repository at this point in the history
### What?

There are tests under `next-dev-tests` which used native binary to run tests for Turbopack. This should belong to next.js integration tests, and also indeed there are overlaps.

As a first step, PR removes duplicated styled-jsx test and mark existing test under turbopack test filter as enabled.


Closes WEB-1510
  • Loading branch information
kwonoj committed Sep 7, 2023
1 parent cc34ea5 commit 4f1be5d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.

This file was deleted.

9 changes: 9 additions & 0 deletions packages/next/src/server/lib/router-utils/setup-dev.ts
Expand Up @@ -186,6 +186,15 @@ async function startWatcher(opts: SetupOpts) {

const { jsConfig } = await loadJsConfig(dir, opts.nextConfig)

// For the debugging purpose, check if createNext or equivalent next instance setup in test cases
// works correctly. Normally `run-test` hides output so only will be visible when `--debug` flag is used.
if (process.env.TURBOPACK && process.env.NEXT_TEST_MODE) {
require('console').log('Creating turbopack project', {
dir,
testMode: process.env.NEXT_TEST_MODE,
})
}

const project = await bindings.turbo.createProject({
projectPath: dir,
rootPath: opts.nextConfig.experimental.outputFileTracingRoot || dir,
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/styled-jsx/index.test.ts
@@ -1,7 +1,7 @@
import path from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
import { renderViaHTTP, shouldRunTurboDevTest } from 'next-test-utils'
import webdriver from 'next-webdriver'

const appDir = path.join(__dirname, 'app')
Expand All @@ -11,6 +11,8 @@ function runTest() {
let next: NextInstance

beforeAll(async () => {
const devCommand = shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'

next = await createNext({
files: {
node_modules_bak: new FileRef(path.join(appDir, 'node_modules_bak')),
Expand All @@ -21,7 +23,7 @@ function runTest() {
scripts: {
setup: `cp -r ./node_modules_bak/my-comps ./node_modules;`,
build: `yarn setup && next build`,
dev: `yarn setup && next dev`,
dev: `yarn setup && next ${devCommand}`,
start: 'next start',
},
},
Expand Down
1 change: 1 addition & 0 deletions test/turbopack-tests-manifest.js
Expand Up @@ -21,6 +21,7 @@ const enabledTests = [
'test/e2e/type-module-interop/index.test.ts',
'test/e2e/undici-fetch/index.test.ts',
'test/integration/bigint/test/index.test.js',
'test/e2e/styled-jsx/index.test.ts',
// TODO: re-enable once the logging is aligned
// 'test/integration/middleware-basic/test/index.test.js',
]
Expand Down

0 comments on commit 4f1be5d

Please sign in to comment.