Skip to content

Commit

Permalink
test: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lubieowoce committed Dec 20, 2024
1 parent 103c65d commit ae6b69b
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react'

import EsmFromCjs from 'lib-cjs'

export default function Page() {
return (
<>
<p>
lib-cjs: <EsmFromCjs />
</p>
</>
)
}
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>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react'

const CjsFromEsm = require('lib-esm')

export default function Page() {
return (
<>
<p>
lib-esm: <CjsFromEsm />
</p>
</>
)
}
17 changes: 17 additions & 0 deletions test/e2e/app-dir/client-module-with-package-type/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { nextTestSetup } from 'e2e-utils'

describe('esm-client-module-without-exports', () => {
const { next } = nextTestSetup({
files: __dirname,
})

it('should render without errors: cjs', async () => {
const $ = await next.render$('/import-cjs')
expect($('p').text()).toContain('lib-cjs: esm')
})

it('should render without errors: esm', async () => {
const $ = await next.render$('/require-esm')
expect($('p').text()).toContain('lib-esm: cjs')
})
})
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.

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.

0 comments on commit ae6b69b

Please sign in to comment.