From 84de72842c635618327b115b0202e1359206e948 Mon Sep 17 00:00:00 2001 From: sanyuan <494130947@qq.com> Date: Wed, 9 Nov 2022 11:16:43 +0800 Subject: [PATCH] fix: e2e test error --- .github/workflows/test.yml | 5 +---- package.json | 3 ++- packages/island/scripts/prepare-e2e.cts | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5a45346..9c485c7e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,5 @@ jobs: - name: Lint run: pnpm run lint - - name: Test unit + - name: Test unit and e2e run: pnpm run test - - - name: Test e2e - run: pnpm run e2e:test diff --git a/package.json b/package.json index cca101f2..e37f7411 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "pnpm-install": "pnpm install", "lint": "eslint --ext .ts,.tsx,.js,.jsx --cache ./", "lint:fix": "eslint --fix --ext .js,.jsx,.ts,.tsx --quiet --cache ./", - "test": "vitest run", + "test": "pnpm unit:test && pnpm e2e:test", + "unit:test": "vitest run", "e2e:test": "playwright test", "e2e:prepare": "tsx ./packages/island/scripts/prepare-e2e.cts", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", diff --git a/packages/island/scripts/prepare-e2e.cts b/packages/island/scripts/prepare-e2e.cts index b450aca9..ab10310d 100644 --- a/packages/island/scripts/prepare-e2e.cts +++ b/packages/island/scripts/prepare-e2e.cts @@ -16,12 +16,12 @@ async function prepareE2E() { // ensure after build if (!fse.existsSync(path.resolve(__dirname, '../dist'))) { // exec build command - execa.execaCommandSync('npm run build', { + execa.commandSync('npm run build', { cwd: path.resolve(__dirname, '../') }); } - execa.execaCommandSync('npx playwright install', { + execa.commandSync('npx playwright install', { cwd: path.join(__dirname, '../'), stdout: process.stdout, stdin: process.stdin, @@ -29,13 +29,13 @@ async function prepareE2E() { }); // exec install - execa.execaCommandSync( + execa.commandSync( 'npm i --registry=https://registry.npmmirror.com/', defaultExecaOpts ); // exec dev command - execa.execaCommandSync('npm run dev', defaultExecaOpts); + execa.commandSync('npm run dev', defaultExecaOpts); } prepareE2E();