@@ -30,7 +30,7 @@ test('cannot create project without installing but with starting', async (contex
30
30
const name = context . task . id ;
31
31
32
32
await expect (
33
- execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--start' ] , {
33
+ execa ( 'node' , [ cli , 'create' , name , '--no-install' , '--no-provider' , '-- start'] , {
34
34
cwd : tmpDir ,
35
35
} ) ,
36
36
) . rejects . toThrow ( 'Cannot start project without installing dependencies.' ) ;
@@ -40,7 +40,7 @@ test('create a project', async (context) => {
40
40
const name = context . task . id ;
41
41
const dest = path . join ( tmpDir , name ) ;
42
42
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'] , {
44
44
cwd : tmpDir ,
45
45
} ) ;
46
46
@@ -49,11 +49,54 @@ test('create a project', async (context) => {
49
49
expect ( projectFiles . map ( normaliseSlash ) . sort ( ) ) . toMatchSnapshot ( ) ;
50
50
} ) ;
51
51
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
+
52
95
test ( 'create and build a project' , async ( context ) => {
53
96
const name = context . task . id ;
54
97
const dest = path . join ( tmpDir , name ) ;
55
98
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'] , {
57
100
cwd : tmpDir ,
58
101
} ) ;
59
102
@@ -89,7 +132,7 @@ test('create and eject a project', async (context) => {
89
132
const name = context . task . id ;
90
133
const dest = path . join ( tmpDir , name ) ;
91
134
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'] , {
93
136
cwd : tmpDir ,
94
137
} ) ;
95
138
@@ -117,7 +160,7 @@ test('create, eject and build a project', async (context) => {
117
160
const name = context . task . id ;
118
161
const dest = path . join ( tmpDir , name ) ;
119
162
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'] , {
121
164
cwd : tmpDir ,
122
165
} ) ;
123
166
0 commit comments