@@ -2,7 +2,7 @@ import { execa, execaNode } from "execa";
2
2
import { join , resolve } from "node:path" ;
3
3
import { typecheckProject } from "../src/commands/deploy" ;
4
4
import { readConfig } from "../src/utilities/configFiles" ;
5
- import { rm } from "node:fs/promises" ;
5
+ import { rename , rm } from "node:fs/promises" ;
6
6
import { readFileSync } from "node:fs" ;
7
7
8
8
type TestCase = {
@@ -27,15 +27,33 @@ const testCases = process.env.MOD
27
27
28
28
const commandPath = resolve ( join ( process . cwd ( ) , "dist/e2e.js" ) ) ;
29
29
const logLevel = process . env . LOG || "log" ;
30
+ const packageManager = process . env . PM || "npm" ;
30
31
31
32
if ( testCases . length > 0 ) {
33
+ console . log ( `Using ${ packageManager } ` ) ;
34
+
32
35
describe . each ( testCases ) ( "fixture $name" , ( { name, skipTypecheck } ) => {
33
- const packageManager = process . env . PM || "npm" ;
34
36
const fixtureDir = resolve ( join ( process . cwd ( ) , "e2e/fixtures" , name ) ) ;
35
37
36
38
beforeAll ( async ( ) => {
37
39
await rm ( resolve ( join ( fixtureDir , ".trigger" ) ) , { force : true , recursive : true } ) ;
38
40
await rm ( resolve ( join ( fixtureDir , "node_modules" ) ) , { force : true , recursive : true } ) ;
41
+ if ( packageManager === "npm" ) {
42
+ // `npm ci` & `npm install` will update an existing yarn.lock
43
+ await rename (
44
+ resolve ( join ( fixtureDir , "yarn.lock" ) ) ,
45
+ resolve ( join ( fixtureDir , "yarn.lock.copy" ) )
46
+ ) ;
47
+ }
48
+ } ) ;
49
+
50
+ afterAll ( async ( ) => {
51
+ if ( packageManager === "npm" ) {
52
+ await rename (
53
+ resolve ( join ( fixtureDir , "yarn.lock.copy" ) ) ,
54
+ resolve ( join ( fixtureDir , "yarn.lock" ) )
55
+ ) ;
56
+ }
39
57
} ) ;
40
58
41
59
test (
0 commit comments