File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
packages/next/build/babel/plugins Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ import {
3131
3232import { relative as relativePath } from 'path'
3333
34+ const isTest = process . env . NODE_ENV === 'test'
35+
3436export default function ( {
3537 types : t ,
3638} : {
@@ -166,7 +168,7 @@ export default function ({
166168
167169 if ( ! dynamicImports . length ) return
168170
169- options . node . properties . push (
171+ ! isTest && options . node . properties . push (
170172 t . objectProperty (
171173 t . identifier ( 'loadableGenerated' ) ,
172174 t . objectExpression ( [
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ export default function Hello ( ) {
4+ return < div > hello</ div >
5+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * @jest -environment jsdom
3+ */
4+ import React from 'react'
5+ import { act , render } from '@testing-library/react'
6+ import dynamic from 'next/dynamic'
7+
8+ describe ( 'next/dynamic' , ( ) => {
9+ it ( 'test link with unmount' , ( ) => {
10+ const App = dynamic ( ( ) => import ( './fixtures/stub-components/hello' ) )
11+ act ( ( ) => {
12+ const { unmount } = render ( < App /> )
13+ unmount ( )
14+ } )
15+ } )
16+ } )
You can’t perform that action at this time.
0 commit comments