@@ -211,6 +211,7 @@ afterAll(async () => {
211211test ( '[vc build] should build project with corepack and select npm@8.1.0' , async ( ) => {
212212 try {
213213 process . env . ENABLE_EXPERIMENTAL_COREPACK = '1' ;
214+ process . env . SKIP_YARN_COREPACK_CHECK = '1' ;
214215 const directory = await setupE2EFixture ( 'vc-build-corepack-npm' ) ;
215216 const before = await exec ( directory , 'npm' , [ '--version' ] ) ;
216217 const output = await execCli ( binaryPath , [ 'build' ] , { cwd : directory } ) ;
@@ -234,55 +235,68 @@ test('[vc build] should build project with corepack and select npm@8.1.0', async
234235 expect ( contents ) . toEqual ( [ 'home' , 'shim' ] ) ;
235236 } finally {
236237 delete process . env . ENABLE_EXPERIMENTAL_COREPACK ;
238+ delete process . env . SKIP_YARN_COREPACK_CHECK ;
237239 }
238240} ) ;
239241
240242test ( '[vc build] should build project with corepack and select pnpm@7.1.0' , async ( ) => {
241- process . env . ENABLE_EXPERIMENTAL_COREPACK = '1' ;
242- const directory = await setupE2EFixture ( 'vc-build-corepack-pnpm' ) ;
243- const before = await exec ( directory , 'pnpm' , [ '--version' ] ) ;
244- const output = await execCli ( binaryPath , [ 'build' ] , { cwd : directory } ) ;
245- expect ( output . exitCode , formatOutput ( output ) ) . toBe ( 0 ) ;
246- expect ( output . stderr ) . toMatch ( / B u i l d C o m p l e t e d / gm) ;
247- const after = await exec ( directory , 'pnpm' , [ '--version' ] ) ;
248- // Ensure global pnpm didn't change
249- expect ( before . stdout ) . toBe ( after . stdout ) ;
250- // Ensure version is correct
251- expect (
252- await fs . readFile (
253- path . join ( directory , '.vercel/output/static/index.txt' ) ,
254- 'utf8'
255- )
256- ) . toBe ( '7.1.0\n' ) ;
257- // Ensure corepack will be cached
258- const contents = fs . readdirSync (
259- path . join ( directory , '.vercel/cache/corepack' )
260- ) ;
261- expect ( contents ) . toEqual ( [ 'home' , 'shim' ] ) ;
243+ try {
244+ process . env . ENABLE_EXPERIMENTAL_COREPACK = '1' ;
245+ process . env . SKIP_YARN_COREPACK_CHECK = '1' ;
246+ const directory = await setupE2EFixture ( 'vc-build-corepack-pnpm' ) ;
247+ const before = await exec ( directory , 'pnpm' , [ '--version' ] ) ;
248+ const output = await execCli ( binaryPath , [ 'build' ] , { cwd : directory } ) ;
249+ expect ( output . exitCode , formatOutput ( output ) ) . toBe ( 0 ) ;
250+ expect ( output . stderr ) . toMatch ( / B u i l d C o m p l e t e d / gm) ;
251+ const after = await exec ( directory , 'pnpm' , [ '--version' ] ) ;
252+ // Ensure global pnpm didn't change
253+ expect ( before . stdout ) . toBe ( after . stdout ) ;
254+ // Ensure version is correct
255+ expect (
256+ await fs . readFile (
257+ path . join ( directory , '.vercel/output/static/index.txt' ) ,
258+ 'utf8'
259+ )
260+ ) . toBe ( '7.1.0\n' ) ;
261+ // Ensure corepack will be cached
262+ const contents = fs . readdirSync (
263+ path . join ( directory , '.vercel/cache/corepack' )
264+ ) ;
265+ expect ( contents ) . toEqual ( [ 'home' , 'shim' ] ) ;
266+ } finally {
267+ delete process . env . ENABLE_EXPERIMENTAL_COREPACK ;
268+ delete process . env . SKIP_YARN_COREPACK_CHECK ;
269+ }
262270} ) ;
263271
264272test ( '[vc build] should build project with corepack and select yarn@2.4.3' , async ( ) => {
265- process . env . ENABLE_EXPERIMENTAL_COREPACK = '1' ;
266- const directory = await setupE2EFixture ( 'vc-build-corepack-yarn' ) ;
267- const before = await exec ( directory , 'yarn' , [ '--version' ] ) ;
268- const output = await execCli ( binaryPath , [ 'build' ] , { cwd : directory } ) ;
269- expect ( output . exitCode , formatOutput ( output ) ) . toBe ( 0 ) ;
270- expect ( output . stderr ) . toMatch ( / B u i l d C o m p l e t e d / gm) ;
271- const after = await exec ( directory , 'yarn' , [ '--version' ] ) ;
272- // Ensure global yarn didn't change
273- expect ( before . stdout ) . toBe ( after . stdout ) ;
274- // Ensure version is correct
275- expect (
276- await fs . readFile (
277- path . join ( directory , '.vercel/output/static/index.txt' ) ,
278- 'utf8'
279- )
280- ) . toBe ( '2.4.3\n' ) ;
281- // Ensure corepack will be cached
282- const contents = fs . readdirSync (
283- path . join ( directory , '.vercel/cache/corepack' )
284- ) ;
285- expect ( contents ) . toEqual ( [ 'home' , 'shim' ] ) ;
273+ try {
274+ process . env . ENABLE_EXPERIMENTAL_COREPACK = '1' ;
275+ process . env . SKIP_YARN_COREPACK_CHECK = '1' ;
276+ const directory = await setupE2EFixture ( 'vc-build-corepack-yarn' ) ;
277+ const before = await exec ( directory , 'yarn' , [ '--version' ] ) ;
278+ const output = await execCli ( binaryPath , [ 'build' ] , { cwd : directory } ) ;
279+ expect ( output . exitCode , formatOutput ( output ) ) . toBe ( 0 ) ;
280+ expect ( output . stderr ) . toMatch ( / B u i l d C o m p l e t e d / gm) ;
281+ const after = await exec ( directory , 'yarn' , [ '--version' ] ) ;
282+ // Ensure global yarn didn't change
283+ expect ( before . stdout ) . toBe ( after . stdout ) ;
284+ // Ensure version is correct
285+ expect (
286+ await fs . readFile (
287+ path . join ( directory , '.vercel/output/static/index.txt' ) ,
288+ 'utf8'
289+ )
290+ ) . toBe ( '2.4.3\n' ) ;
291+ // Ensure corepack will be cached
292+ const contents = fs . readdirSync (
293+ path . join ( directory , '.vercel/cache/corepack' )
294+ ) ;
295+ expect ( contents ) . toEqual ( [ 'home' , 'shim' ] ) ;
296+ } finally {
297+ delete process . env . ENABLE_EXPERIMENTAL_COREPACK ;
298+ delete process . env . SKIP_YARN_COREPACK_CHECK ;
299+ }
286300} ) ;
287301
288302test ( '[vc dev] should print help from `vc develop --help`' , async ( ) => {
0 commit comments