@@ -30,7 +30,7 @@ test('cannot create project without installing but with starting', async (contex
3030 const name = context . task . id ;
3131
3232 await expect (
33- execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--start' ] , {
33+ execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-provider' , '-- start'] , {
3434 cwd : tmpDir ,
3535 } ) ,
3636 ) . rejects . toThrow ( 'Cannot start project without installing dependencies.' ) ;
@@ -40,7 +40,7 @@ test('create a project', async (context) => {
4040 const name = context . task . id ;
4141 const dest = path . join ( tmpDir , name ) ;
4242
43- await execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-git' , '--defaults' ] , {
43+ await execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-git' , '--no-provider' , '-- defaults'] , {
4444 cwd : tmpDir ,
4545 } ) ;
4646
@@ -49,11 +49,54 @@ test('create a project', async (context) => {
4949 expect ( projectFiles . map ( normaliseSlash ) . sort ( ) ) . toMatchSnapshot ( ) ;
5050} ) ;
5151
52+ test ( 'create a project with Netlify as provider' , async ( context ) => {
53+ const name = context . task . id ;
54+ const dest = path . join ( tmpDir , name ) ;
55+
56+ await execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-git' , '--defaults' , '--provider' , 'netlify' ] , {
57+ cwd : tmpDir ,
58+ } ) ;
59+
60+ const projectFiles = await fs . readdir ( dest , { recursive : true } ) ;
61+ expect ( projectFiles ) . toContain ( 'netlify.toml' ) ;
62+ } ) ;
63+
64+ test ( 'create a project with Cloudflare as provider' , async ( context ) => {
65+ const name = context . task . id ;
66+ const dest = path . join ( tmpDir , name ) ;
67+
68+ await execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-git' , '--defaults' , '--provider' , 'cloudflare' ] , {
69+ cwd : tmpDir ,
70+ } ) ;
71+
72+ const projectFiles = await fs . readdir ( dest , { recursive : true } ) ;
73+ expect ( projectFiles ) . toContain ( '_headers' ) ;
74+
75+ const packageJson = await fs . readFile ( `${ dest } /package.json` , 'utf8' ) ;
76+ const json = JSON . parse ( packageJson ) ;
77+
78+ expect ( json ) . toHaveProperty ( 'scripts' ) ;
79+ expect ( json . scripts ) . toHaveProperty ( 'postbuild' ) ;
80+ expect ( json . scripts . postbuild ) . toBe ( 'cp _headers ./dist/' ) ;
81+ } ) ;
82+
83+ test ( 'create a project with Vercel as provider' , async ( context ) => {
84+ const name = context . task . id ;
85+ const dest = path . join ( tmpDir , name ) ;
86+
87+ await execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-git' , '--defaults' , '--provider' , 'vercel' ] , {
88+ cwd : tmpDir ,
89+ } ) ;
90+
91+ const projectFiles = await fs . readdir ( dest , { recursive : true } ) ;
92+ expect ( projectFiles ) . toContain ( 'vercel.json' ) ;
93+ } ) ;
94+
5295test ( 'create and build a project' , async ( context ) => {
5396 const name = context . task . id ;
5497 const dest = path . join ( tmpDir , name ) ;
5598
56- await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--defaults' ] , {
99+ await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--no-provider' , '-- defaults'] , {
57100 cwd : tmpDir ,
58101 } ) ;
59102
@@ -89,7 +132,7 @@ test('create and eject a project', async (context) => {
89132 const name = context . task . id ;
90133 const dest = path . join ( tmpDir , name ) ;
91134
92- await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--defaults' ] , {
135+ await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--no-provider' , '-- defaults'] , {
93136 cwd : tmpDir ,
94137 } ) ;
95138
@@ -117,7 +160,7 @@ test('create, eject and build a project', async (context) => {
117160 const name = context . task . id ;
118161 const dest = path . join ( tmpDir , name ) ;
119162
120- await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--defaults' ] , {
163+ await execa ( 'node' , [ cli , 'create' , name , '--no-git' , '--no-install' , '--no-start' , '--no-provider' , '-- defaults'] , {
121164 cwd : tmpDir ,
122165 } ) ;
123166
0 commit comments