Skip to content

Commit

Permalink
tests(next-dev): migrate basic tailwind tests for turbopack (#55118)
Browse files Browse the repository at this point in the history
Closes WEB-1518

### What?

This PR refactors test cases from next-dev, tests basic tailwind rendering with turbopack. It still runs against plain next.js too. While checking, noticed there's a stub fixture (css-fixture/with-tailwindcss) but those fixture seems not being used in the test. Moved those and utilized. Since this test runs against next.js / turbopack both anyway, moving fixture should not be a huge regression I believe.
  • Loading branch information
kwonoj authored Sep 11, 2023
1 parent 40da1ae commit 360142d
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 303 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

44 changes: 22 additions & 22 deletions test/development/basic/tailwind-jit.test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { join } from 'path'
import webdriver from 'next-webdriver'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { check } from 'next-test-utils'
import { FileRef, nextTestSetup } from 'e2e-utils'
import { check, shouldRunTurboDevTest } from 'next-test-utils'

describe('TailwindCSS JIT', () => {
let next: NextInstance
// [TODO]: It is unclear why turbopack takes longer to run this test
// remove once it's fixed
if (shouldRunTurboDevTest()) {
jest.setTimeout(1000 * 60 * 5)
}

beforeAll(async () => {
next = await createNext({
files: {
'postcss.config.js': new FileRef(
join(__dirname, 'tailwind-jit/postcss.config.js')
),
'tailwind.config.js': new FileRef(
join(__dirname, 'tailwind-jit/tailwind.config.js')
),
pages: new FileRef(join(__dirname, 'tailwind-jit/pages')),
},
dependencies: {
tailwindcss: '2.2.19',
postcss: '8.3.5',
},
})
describe('TailwindCSS JIT', () => {
const { next } = nextTestSetup({
files: {
'postcss.config.js': new FileRef(
join(__dirname, 'tailwind-jit/postcss.config.js')
),
'tailwind.config.js': new FileRef(
join(__dirname, 'tailwind-jit/tailwind.config.js')
),
pages: new FileRef(join(__dirname, 'tailwind-jit/pages')),
},
dependencies: {
tailwindcss: '2.2.19',
postcss: '8.3.5',
},
})
afterAll(() => next.destroy())

it('works with JIT enabled', async () => {
let browser
Expand Down
7 changes: 0 additions & 7 deletions test/integration/css-fixtures/with-tailwindcss/package.json

This file was deleted.

5 changes: 0 additions & 5 deletions test/integration/css-fixtures/with-tailwindcss/pages/_app.js

This file was deleted.

3 changes: 0 additions & 3 deletions test/integration/css-fixtures/with-tailwindcss/pages/index.js

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion test/turbopack-tests-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const enabledTests = [
'test/development/basic/legacy-decorators.test.ts',
'test/development/basic/misc.test.ts',
'test/development/basic/next-rs-api.test.ts',
'test/development/basic/tailwind-jit.test.ts',
'test/development/basic/theme-ui.test.ts',
'test/development/client-dev-overlay/index.test.ts',
'test/development/correct-tsconfig-defaults/index.test.ts',
Expand Down Expand Up @@ -158,7 +159,6 @@ module.exports = { enabledTests }
'test/development/basic/emotion-swc.test.ts',
'test/development/basic/legacy-decorators.test.ts',
'test/development/basic/project-directory-rename.test.ts',
'test/development/basic/tailwind-jit.test.ts',
'test/development/basic/theme-ui.test.ts',
'test/development/dotenv-default-expansion/index.test.ts',
'test/development/jsconfig-path-reloading/index.test.ts',
Expand Down

0 comments on commit 360142d

Please sign in to comment.