11import * as fs from "node:fs" ;
22import path from "node:path" ;
3- import { execa } from "execa " ;
3+ import { x } from "tinyexec " ;
44import { http , HttpResponse } from "msw" ;
55import * as TOML from "smol-toml" ;
66import dedent from "ts-dedent" ;
@@ -72,23 +72,27 @@ describe("init", () => {
7272 }
7373 ` ) ;
7474
75- expect ( execa ) . toHaveBeenCalledWith (
75+ expect ( x ) . toHaveBeenCalledWith (
7676 "mockpm" ,
7777 [ "create" , "cloudflare@^2.5.0" ] ,
7878 {
79- stdio : [ "inherit" , "pipe" , "pipe" ] ,
79+ nodeOptions : {
80+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
81+ } ,
8082 }
8183 ) ;
8284 } ) ;
8385
8486 it ( "if `-y` is used, delegate to c3 with --wrangler-defaults" , async ( ) => {
8587 await runWrangler ( "init -y" ) ;
8688
87- expect ( execa ) . toHaveBeenCalledWith (
89+ expect ( x ) . toHaveBeenCalledWith (
8890 "mockpm" ,
8991 [ "create" , "cloudflare@^2.5.0" , "--wrangler-defaults" ] ,
9092 {
91- stdio : [ "inherit" , "pipe" , "pipe" ] ,
93+ nodeOptions : {
94+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
95+ } ,
9296 }
9397 ) ;
9498 } ) ;
@@ -124,23 +128,27 @@ describe("init", () => {
124128 }
125129 ` ) ;
126130
127- expect ( execa ) . toHaveBeenCalledWith (
131+ expect ( x ) . toHaveBeenCalledWith (
128132 "mockpm" ,
129133 [ "run" , "create-cloudflare" ] ,
130134 {
131- stdio : [ "inherit" , "pipe" , "pipe" ] ,
135+ nodeOptions : {
136+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
137+ } ,
132138 }
133139 ) ;
134140 } ) ;
135141
136142 it ( "if `-y` is used, delegate to c3 with --wrangler-defaults" , async ( ) => {
137143 await runWrangler ( "init -y" ) ;
138144
139- expect ( execa ) . toHaveBeenCalledWith (
145+ expect ( x ) . toHaveBeenCalledWith (
140146 "mockpm" ,
141147 [ "run" , "create-cloudflare" , "--wrangler-defaults" ] ,
142148 {
143- stdio : [ "inherit" , "pipe" , "pipe" ] ,
149+ nodeOptions : {
150+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
151+ } ,
144152 }
145153 ) ;
146154 } ) ;
@@ -155,14 +163,16 @@ describe("init", () => {
155163 } ) ;
156164 await runWrangler ( "init" ) ;
157165
158- expect ( execa ) . toHaveBeenCalledWith (
166+ expect ( x ) . toHaveBeenCalledWith (
159167 "mockpm" ,
160168 [ "create" , "cloudflare@^2.5.0" ] ,
161169 {
162- env : {
163- CREATE_CLOUDFLARE_TELEMETRY_DISABLED : "1" ,
170+ nodeOptions : {
171+ env : {
172+ CREATE_CLOUDFLARE_TELEMETRY_DISABLED : "1" ,
173+ } ,
174+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
164175 } ,
165- stdio : [ "inherit" , "pipe" , "pipe" ] ,
166176 }
167177 ) ;
168178 } ) ;
@@ -805,8 +815,8 @@ describe("init", () => {
805815 }
806816 ` ) ;
807817
808- expect ( execa ) . toHaveBeenCalledTimes ( 1 ) ;
809- expect ( execa ) . toHaveBeenCalledWith (
818+ expect ( x ) . toHaveBeenCalledTimes ( 1 ) ;
819+ expect ( x ) . toHaveBeenCalledWith (
810820 "mockpm" ,
811821 [
812822 "create" ,
@@ -816,7 +826,9 @@ describe("init", () => {
816826 "existing-memory-crystal" ,
817827 ] ,
818828 {
819- stdio : [ "inherit" , "pipe" , "pipe" ] ,
829+ nodeOptions : {
830+ stdio : [ "inherit" , "pipe" , "pipe" ] ,
831+ } ,
820832 }
821833 ) ;
822834 } ) ;
0 commit comments