Skip to content

Commit

Permalink
Add failing test for #66058
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed May 25, 2024
1 parent 0f1d9e9 commit 329f366
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/app-dir/typeof-window/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!node_modules
8 changes: 8 additions & 0 deletions test/e2e/app-dir/typeof-window/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ReactNode } from 'react'
export default function Root({ children }: { children: ReactNode }) {
return (
<html>
<body>{children}</body>
</html>
)
}
10 changes: 10 additions & 0 deletions test/e2e/app-dir/typeof-window/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use client'
if (typeof window !== 'undefined') {
import('my-differentiated-files/browser').then((mod) => {
console.log({ TEST: mod.default })
})
}

export default function Page() {
return <h1>Page loaded</h1>
}
6 changes: 6 additions & 0 deletions test/e2e/app-dir/typeof-window/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {}

module.exports = nextConfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions test/e2e/app-dir/typeof-window/typeof-window.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { nextTestSetup } from 'e2e-utils'

describe('typeof-window', () => {
const { next } = nextTestSetup({
files: __dirname,
})

it('should work using cheerio', async () => {
const $ = await next.render$('/')
expect($('h1').text()).toBe('Page loaded')
})
})

0 comments on commit 329f366

Please sign in to comment.