Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#36534): enable interopClientDefaultExport for next/jest #36824

Merged
merged 2 commits into from May 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/next/jest.js
@@ -1,4 +1 @@
function interopDefault(mod) {
return mod.default || mod
}
module.exports = interopDefault(require('./dist/build/jest/jest'))
module.exports = require('./dist/build/jest/jest')
14 changes: 13 additions & 1 deletion packages/next/taskfile.js
Expand Up @@ -1763,6 +1763,7 @@ export async function compile(task, opts) {
'bin',
'server',
'nextbuild',
'nextbuildjest',
'nextbuildstatic',
'pages',
'lib',
Expand Down Expand Up @@ -1816,13 +1817,23 @@ export async function server(task, opts) {
export async function nextbuild(task, opts) {
await task
.source(opts.src || 'build/**/*.+(js|ts|tsx)', {
ignore: ['**/fixture/**', '**/tests/**'],
ignore: ['**/fixture/**', '**/tests/**', '**/jest/**'],
})
.swc('server', { dev: opts.dev })
.target('dist/build')
notify('Compiled build files')
}

export async function nextbuildjest(task, opts) {
await task
.source(opts.src || 'build/jest/**/*.+(js|ts|tsx)', {
ignore: ['**/fixture/**', '**/tests/**'],
})
.swc('server', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/build/jest')
notify('Compiled build/jest files')
}

export async function client(task, opts) {
await task
.source(opts.src || 'client/**/*.+(js|ts|tsx)')
Expand Down Expand Up @@ -1903,6 +1914,7 @@ export default async function (task) {
await task.watch('pages/**/*.+(js|ts|tsx)', 'pages', opts)
await task.watch('server/**/*.+(js|ts|tsx)', 'server', opts)
await task.watch('build/**/*.+(js|ts|tsx)', 'nextbuild', opts)
await task.watch('build/jest/**/*.+(js|ts|tsx)', 'nextbuildjest', opts)
await task.watch('export/**/*.+(js|ts|tsx)', 'nextbuildstatic', opts)
await task.watch('client/**/*.+(js|ts|tsx)', 'client', opts)
await task.watch('lib/**/*.+(js|ts|tsx)', 'lib', opts)
Expand Down