Skip to content

Commit

Permalink
fix(#36534): enable interopClientDefaultExport for next/jest (#36824)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed May 11, 2022
1 parent 2e13534 commit d76bbde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
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

0 comments on commit d76bbde

Please sign in to comment.