@@ -13,53 +13,66 @@ describe('Mixed getStaticProps and getServerSideProps error', () => {
1313 ; ( process . env . TURBOPACK_DEV ? describe . skip : describe ) (
1414 'production mode' ,
1515 ( ) => {
16- it ( 'should error with getStaticProps but no default export' , async ( ) => {
17- // TODO: remove after investigating why dev swc build fails here
18- await fs . writeFile (
19- join ( appDir , '.babelrc' ) ,
20- '{ "presets": ["next/babel"] }'
21- )
22- await fs . move ( indexPage , indexPageBak )
23- await fs . writeFile (
24- indexPage ,
25- `
16+ // Uses Babel, not supported in Turbopack.
17+ ; ( process . env . TURBOPACK ? it . skip : it ) (
18+ 'should error with getStaticProps but no default export' ,
19+ async ( ) => {
20+ // TODO: remove after investigating why dev swc build fails here
21+ await fs . writeFile (
22+ join ( appDir , '.babelrc' ) ,
23+ '{ "presets": ["next/babel"] }'
24+ )
25+ await fs . move ( indexPage , indexPageBak )
26+ await fs . writeFile (
27+ indexPage ,
28+ `
2629 export function getStaticProps() {
2730 return {
2831 props: {}
2932 }
3033 }
3134 `
32- )
33- const { stderr } = await nextBuild ( appDir , [ ] , { stderr : true } )
34- await fs . remove ( join ( appDir , '.babelrc' ) )
35- await fs . remove ( indexPage )
36- await fs . move ( indexPageBak , indexPage )
37- expect ( stderr ) . toContain (
38- 'found page without a React Component as default export in'
39- )
40- } )
35+ )
36+ const { stderr } = await nextBuild ( appDir , [ ] , { stderr : true } )
37+ await fs . remove ( join ( appDir , '.babelrc' ) )
38+ await fs . remove ( indexPage )
39+ await fs . move ( indexPageBak , indexPage )
40+ // eslint-disable-next-line jest/no-standalone-expect
41+ expect ( stderr ) . toContain (
42+ 'found page without a React Component as default export in'
43+ )
44+ }
45+ )
4146
42- it ( 'should error when exporting both getStaticProps and getServerSideProps' , async ( ) => {
43- // TODO: remove after investigating why dev swc build fails here
44- await fs . writeFile (
45- join ( appDir , '.babelrc' ) ,
46- '{ "presets": ["next/babel"] }'
47- )
48- const { stderr } = await nextBuild ( appDir , [ ] , { stderr : true } )
49- await fs . remove ( join ( appDir , '.babelrc' ) )
50- expect ( stderr ) . toContain ( SERVER_PROPS_SSG_CONFLICT )
51- } )
47+ // Uses Babel, not supported in Turbopack.
48+ ; ( process . env . TURBOPACK ? it . skip : it ) (
49+ 'should error when exporting both getStaticProps and getServerSideProps' ,
50+ async ( ) => {
51+ // TODO: remove after investigating why dev swc build fails here
52+ await fs . writeFile (
53+ join ( appDir , '.babelrc' ) ,
54+ '{ "presets": ["next/babel"] }'
55+ )
56+ const { stderr } = await nextBuild ( appDir , [ ] , { stderr : true } )
57+ await fs . remove ( join ( appDir , '.babelrc' ) )
58+ // eslint-disable-next-line jest/no-standalone-expect
59+ expect ( stderr ) . toContain ( SERVER_PROPS_SSG_CONFLICT )
60+ }
61+ )
5262
53- it ( 'should error when exporting both getStaticPaths and getServerSideProps' , async ( ) => {
54- // TODO: remove after investigating why dev swc build fails here
55- await fs . writeFile (
56- join ( appDir , '.babelrc' ) ,
57- '{ "presets": ["next/babel"] }'
58- )
59- await fs . move ( indexPage , indexPageBak )
60- await fs . writeFile (
61- indexPage ,
62- `
63+ // Uses Babel, not supported in Turbopack.
64+ ; ( process . env . TURBOPACK ? it . skip : it ) (
65+ 'should error when exporting both getStaticPaths and getServerSideProps' ,
66+ async ( ) => {
67+ // TODO: remove after investigating why dev swc build fails here
68+ await fs . writeFile (
69+ join ( appDir , '.babelrc' ) ,
70+ '{ "presets": ["next/babel"] }'
71+ )
72+ await fs . move ( indexPage , indexPageBak )
73+ await fs . writeFile (
74+ indexPage ,
75+ `
6376 export const getStaticPaths = async () => {
6477 return {
6578 props: { world: 'world' }, fallback: true
@@ -74,14 +87,17 @@ describe('Mixed getStaticProps and getServerSideProps error', () => {
7487
7588 export default ({ world }) => <p>Hello {world}</p>
7689 `
77- )
78- const { stderr, code } = await nextBuild ( appDir , [ ] , { stderr : true } )
79- await fs . remove ( join ( appDir , '.babelrc' ) )
80- await fs . remove ( indexPage )
81- await fs . move ( indexPageBak , indexPage )
82- expect ( code ) . toBe ( 1 )
83- expect ( stderr ) . toContain ( SERVER_PROPS_SSG_CONFLICT )
84- } )
90+ )
91+ const { stderr, code } = await nextBuild ( appDir , [ ] , { stderr : true } )
92+ await fs . remove ( join ( appDir , '.babelrc' ) )
93+ await fs . remove ( indexPage )
94+ await fs . move ( indexPageBak , indexPage )
95+ // eslint-disable-next-line jest/no-standalone-expect
96+ expect ( code ) . toBe ( 1 )
97+ // eslint-disable-next-line jest/no-standalone-expect
98+ expect ( stderr ) . toContain ( SERVER_PROPS_SSG_CONFLICT )
99+ }
100+ )
85101
86102 it ( 'should error when exporting getStaticPaths on a non-dynamic page' , async ( ) => {
87103 await fs . move ( indexPage , indexPageBak )
0 commit comments