Skip to content

Commit 16a1e27

Browse files
Fix: Use npx to run Playwright without modifying lockfile
1 parent 25f83a5 commit 16a1e27

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { test as base } from '@playwright/test';
1+
// Use require instead of import to avoid TypeScript errors
2+
const { test: base, expect } = require('@playwright/test');
23

34
// Define a fixture that sets up the test environment
45
export const test = base.extend({
56
// Add any global setup here if needed
67
});
78

8-
export { expect } from '@playwright/test';
9-
9+
export { expect };

apps/e2e/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"test": "playwright test",
7-
"test:ui": "playwright test --ui",
8-
"test:debug": "playwright test --debug",
9-
"report": "playwright show-report"
10-
},
11-
"devDependencies": {
12-
"@playwright/test": "1.14.0"
6+
"install-playwright": "npx playwright@1.40.0 install --with-deps",
7+
"test": "npx playwright@1.40.0 test",
8+
"test:ui": "npx playwright@1.40.0 test --ui",
9+
"test:debug": "npx playwright@1.40.0 test --debug",
10+
"report": "npx playwright@1.40.0 show-report"
1311
}
1412
}
15-

apps/e2e/playwright.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { defineConfig, devices } from '@playwright/test';
22

3-
export default defineConfig({
3+
// Use require instead of import to avoid TypeScript errors
4+
// when @playwright/test is not in node_modules
5+
const { defineConfig, devices } = require('@playwright/test');
6+
7+
module.exports = defineConfig({
48
testDir: './tests',
59
timeout: 60000,
610
fullyParallel: true,
@@ -31,8 +35,7 @@ export default defineConfig({
3135
webServer: process.env.CI ? undefined : {
3236
command: 'cd ../.. && yarn dev',
3337
url: 'http://localhost:3000',
34-
reuseExistingServer: true,
38+
reuseExistingServer: !process.env.CI,
3539
timeout: 120000,
3640
},
3741
});
38-

apps/e2e/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"outDir": "dist",
99
"baseUrl": ".",
1010
"strict": true,
11-
"lib": ["esnext", "dom"]
11+
"lib": ["esnext", "dom"],
12+
"allowJs": true,
13+
"checkJs": false
1214
},
13-
"include": ["**/*.ts"]
15+
"include": ["**/*.ts", "**/*.js"]
1416
}
15-

0 commit comments

Comments
 (0)