File size: 1,401 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { createNext } from 'e2e-utils'
import { renderViaHTTP } from 'next-test-utils'
import { NextInstance } from 'e2e-utils'

describe('PostCSS plugin config as string', () => {
  let next: NextInstance

  beforeAll(async () => {
    next = await createNext({
      files: {
        'pages/index.js': `
          export default function Page() {
            return <p>hello world</p>
          }
        `,
        'global.css': `
          @import "tailwindcss/base";
          @import "tailwindcss/components";
          @import "tailwindcss/utilities";
        `,
        'pages/_app.js': `
          import "../global.css"
          
          export default function MyApp({ Component, pageProps }) {
            return <Component {...pageProps} />
          }
        `,
        'postcss.config.js': `
          module.exports = {
            plugins: {
              'tailwindcss/nesting': 'postcss-nesting',
              tailwindcss: {},
            },
          }
        `,
        'tailwind.config.js': `
          module.exports = {
            content: ['./pages/**/*'],
          }
        `,
      },
      dependencies: {
        'postcss-nesting': '10.1.3',
        tailwindcss: '3.0.23',
      },
    })
  })
  afterAll(() => next.destroy())

  it('should work', async () => {
    const html = await renderViaHTTP(next.url, '/')
    expect(html).toContain('hello world')
  })
})