@@ -5,7 +5,7 @@ createNextDescribe(
55 {
66 files : __dirname ,
77 } ,
8- ( { next, isNextDev , isNextStart } ) => {
8+ ( { next, isNextStart } ) => {
99 function runTests ( ) {
1010 it ( 'should render routes marked with restriction marks without errors' , async ( ) => {
1111 const routes = [
@@ -21,6 +21,7 @@ createNextDescribe(
2121 // pages/api
2222 '/api/hello' ,
2323 '/api/hello-edge' ,
24+ '/api/mixed' ,
2425 ]
2526
2627 for ( const route of routes ) {
@@ -61,39 +62,38 @@ createNextDescribe(
6162
6263 describe ( 'no server-only in server targets' , ( ) => {
6364 const middlewareFile = 'middleware.js'
64- const pagesApiFile = 'pages/api/hello.js'
65+ // const pagesApiFile = 'pages/api/hello.js'
6566 let middlewareContent = ''
66- let pagesApiContent = ''
67+ // let pagesApiContent = ''
6768
6869 beforeAll ( async ( ) => {
6970 await next . stop ( )
7071
7172 middlewareContent = await next . readFile ( middlewareFile )
73+ // pagesApiContent = await next.readFile(pagesApiFile)
74+
7275 await next . patchFile (
7376 middlewareFile ,
7477 middlewareContent
7578 . replace ( "import 'server-only'" , "// import 'server-only'" )
76- . replace (
77- "// import { sharedComponentValue } from './lib/mixed-lib'" ,
78- "import { sharedComponentValue } from './lib/mixed-lib'"
79- )
80- )
81- pagesApiContent = await next . readFile ( pagesApiFile )
82- await next . patchFile (
83- pagesApiFile ,
84- pagesApiContent
85- . replace ( "import 'server-only'" , "// import 'server-only'" )
86- . replace (
87- "// import { sharedComponentValue } from '../../lib/mixed-lib'" ,
88- "import { sharedComponentValue } from '../../lib/mixed-lib'"
89- )
79+ . replace ( "// import './lib/mixed-lib'" , "import './lib/mixed-lib'" )
9080 )
9181
82+ // await next.patchFile(
83+ // pagesApiFile,
84+ // pagesApiContent
85+ // .replace("import 'server-only'", "// import 'server-only'")
86+ // .replace(
87+ // "// import '../../lib/mixed-lib'",
88+ // "import '../../lib/mixed-lib'"
89+ // )
90+ // )
91+
9292 await next . start ( )
9393 } )
9494 afterAll ( async ( ) => {
9595 await next . patchFile ( middlewareFile , middlewareContent )
96- await next . patchFile ( pagesApiFile , pagesApiContent )
96+ // await next.patchFile(pagesApiFile, pagesApiContent)
9797 } )
9898 runTests ( )
9999 } )
0 commit comments