@@ -73,9 +73,20 @@ afterEach(async () => {
73
73
} )
74
74
75
75
const DUMMY_PACKAGE_JSON = { name : 'dummy' , version : '1.0.0' }
76
- const netlifyConfig = { build : { } }
76
+ const netlifyConfig = { build : { command : 'next build' } }
77
77
78
78
describe ( 'preBuild()' , ( ) => {
79
+ test ( 'do nothing if the app has no build command' , async ( ) => {
80
+ await plugin . onPreBuild ( {
81
+ netlifyConfig : { build : { command : '' } } ,
82
+ packageJson : { ...DUMMY_PACKAGE_JSON , scripts : { build : 'next build' } } ,
83
+ utils,
84
+ constants : { FUNCTIONS_SRC : 'out_functions' } ,
85
+ } )
86
+
87
+ expect ( await pathExists ( 'next.config.js' ) ) . toBeFalsy ( )
88
+ } )
89
+
79
90
test ( 'do nothing if the app has static html export in npm script' , async ( ) => {
80
91
await plugin . onPreBuild ( {
81
92
netlifyConfig : { build : { command : 'npm run build' } } ,
@@ -205,7 +216,7 @@ describe('onBuild()', () => {
205
216
await moveNextDist ( )
206
217
const PUBLISH_DIR = 'publish'
207
218
await plugin . onBuild ( {
208
- netlifyConfig : { build : { publish : path . resolve ( PUBLISH_DIR ) } } ,
219
+ netlifyConfig : { build : { publish : path . resolve ( PUBLISH_DIR ) , command : 'next build' } } ,
209
220
packageJson : DUMMY_PACKAGE_JSON ,
210
221
constants : {
211
222
PUBLISH_DIR ,
0 commit comments