Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
rm trailing space from test
  • Loading branch information
huozhi committed Apr 30, 2022
1 parent b6e9a39 commit fb3345c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ jobs:
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/18
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: xvfb-run node run-tests.js test/e2e/pnpm-ssr/index.test.ts
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- name: Upload test trace
if: always()
uses: actions/upload-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function IndexPage() {
return (
<div>
<h1>Hello World.</h1>

<style jsx global>{`
@supports (display: flex) {
h1 {
Expand Down
34 changes: 34 additions & 0 deletions test/e2e/pnpm-ssr/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
import cheerio from 'cheerio'

describe('pnpm ssr', () => {
let next: NextInstance

beforeAll(async () => {
next = await createNext({
files: {
'pages/index.js': `
export default function Page() {
return (
<div>
<style jsx>{'p { color: red; }'}</style>
<p>hello world</p>
</div>
)
}
`,
},
dependencies: {},
installCommand: 'pnpm install',
})
})
afterAll(() => next.destroy())

it('should contain styled-jsx styles in html', async () => {
const html = await renderViaHTTP(next.url, '/')
const $ = cheerio.load(html)
expect($('head').text()).toContain('color:red')
})
})

0 comments on commit fb3345c

Please sign in to comment.