-
Notifications
You must be signed in to change notification settings - Fork 26.1k
/
index.test.ts
36 lines (31 loc) · 986 Bytes
/
index.test.ts
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
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 cheerio from 'cheerio'
const appDir = path.join(__dirname, 'app')
function runTest(packageManager?: string) {
describe(`styled-jsx${packageManager ? ' ' + packageManager : ''}`, () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
pages: new FileRef(path.join(appDir, 'pages')),
},
...(packageManager
? {
installCommand: `npx ${packageManager} install`,
}
: {}),
})
})
afterAll(() => next.destroy())
it('should contain styled-jsx styles in html', async () => {
const html = await renderViaHTTP(next.url, '/')
const $ = cheerio.load(html)
expect($('html').text()).toMatch(/color:(\s)*red/)
})
})
}
runTest()
runTest('pnpm')