Skip to content

Commit 91b8480

Browse files
committed
fix(ci): use node to run playwright CLI directly for proper module resolution
This fixes the ERR_MODULE_NOT_FOUND error in CI by using node to run the Playwright CLI script directly from the local installation, ensuring proper module resolution of @playwright/test in CI environments.
1 parent 1931749 commit 91b8480

2 files changed

Lines changed: 42 additions & 16 deletions

File tree

frontend/.gitignore

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
.DS_Store
12
node_modules
2-
3-
# Output
4-
.output
5-
.vercel
63
/.svelte-kit
74
/build
8-
9-
# OS
10-
.DS_Store
11-
Thumbs.db
12-
13-
# Env
14-
.env.local
5+
.env
6+
.env.*
157
!.env.example
168
!.env.test
17-
18-
# Vite
199
vite.config.js.timestamp-*
2010
vite.config.ts.timestamp-*
2111

22-
# Sentry Config File
23-
.env.sentry-build-plugin
12+
# Playwright
13+
/test-results/
14+
/playwright-report/
15+
/playwright/.cache/
16+
/.auth/
17+
tests/.env
18+
19+
# Test output files
20+
test-*.log
21+
test_output.log
22+
test-results.json
23+
test-run.log
24+
test-final.log

frontend/run-e2e-tests.sh

100644100755
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,38 @@ PASSED_TESTS=0
4040
FAILED_TESTS=0
4141
FAILED_FILES=()
4242

43+
# Ensure we're in the frontend directory
44+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
45+
cd "$SCRIPT_DIR"
46+
47+
# Verify node_modules exists
48+
if [ ! -d "node_modules" ]; then
49+
echo -e "${RED}Error: node_modules not found. Run 'bun install' first.${NC}"
50+
exit 1
51+
fi
52+
53+
# Verify @playwright/test is installed
54+
if [ ! -d "node_modules/@playwright/test" ]; then
55+
echo -e "${RED}Error: @playwright/test not found. Run 'bun install' first.${NC}"
56+
exit 1
57+
fi
58+
59+
# Use node to run the playwright CLI script directly from the local installation
60+
# This ensures proper module resolution in CI environments
61+
PLAYWRIGHT_CLI="node_modules/@playwright/test/cli.js"
62+
63+
if [ ! -f "$PLAYWRIGHT_CLI" ]; then
64+
echo -e "${RED}Error: Playwright CLI not found. Run 'bun install' first.${NC}"
65+
exit 1
66+
fi
67+
4368
# Run each test file
4469
for test_file in "${TEST_FILES[@]}"; do
4570
echo ""
4671
echo -e "${YELLOW}Running: $test_file${NC}"
4772
echo "----------------------------------------"
4873

49-
if bunx playwright test "$test_file" --reporter=list; then
74+
if node "$PLAYWRIGHT_CLI" test "$test_file" --reporter=list; then
5075
echo -e "${GREEN}$test_file passed${NC}"
5176
else
5277
echo -e "${RED}$test_file failed${NC}"

0 commit comments

Comments
 (0)