fix(test-utils): export from core playwright package (#22122)

This commit is contained in:
Daniel Roe 2023-07-13 18:26:04 +01:00 committed by GitHub
parent 4abfb40a78
commit b06ae969f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 33 deletions

View File

@ -214,8 +214,7 @@ jobs:
${{ runner.os }}-playwright-bin-v1-
- name: Install Playwright
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: pnpm playwright install chromium
run: pnpm playwright-core install chromium
- name: Restore dist cache
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2

View File

@ -69,7 +69,7 @@
"nuxt-vitest": "0.8.7",
"ofetch": "1.1.1",
"pathe": "1.1.1",
"playwright": "1.35.1",
"playwright-core": "1.35.1",
"rimraf": "5.0.1",
"semver": "7.5.3",
"std-env": "3.3.3",

View File

@ -34,13 +34,13 @@
},
"devDependencies": {
"@jest/globals": "29.6.0",
"playwright": "1.35.1",
"playwright-core": "1.35.1",
"unbuild": "latest",
"vitest": "0.33.0"
},
"peerDependencies": {
"@jest/globals": "^29.5.0",
"playwright": "^1.34.3",
"playwright-core": "^1.34.3",
"vitest": "^0.30.0 || ^0.31.0 || ^0.32.0 || ^0.33.0",
"vue": "^3.3.4"
},
@ -48,7 +48,7 @@
"@jest/globals": {
"optional": true
},
"playwright": {
"playwright-core": {
"optional": true
},
"vitest": {

View File

@ -1,20 +1,20 @@
import type { Browser, BrowserContextOptions } from 'playwright'
import type { Browser, BrowserContextOptions } from 'playwright-core'
import { useTestContext } from './context'
import { url } from './server'
export async function createBrowser () {
const ctx = useTestContext()
let playwright: typeof import('playwright')
let playwright: typeof import('playwright-core')
try {
// Workaround for https://github.com/nuxt/nuxt/issues/13441
// TODO: Remove when upstream issue resolved
playwright = await import(String('playwright'))
playwright = await import(String('playwright-core'))
} catch {
/* istanbul ignore next */
throw new Error(`
The dependency 'playwright' not found.
Please run 'yarn add --dev playwright' or 'npm install --save-dev playwright'
The dependency 'playwright-core' not found.
Please run 'yarn add --dev playwright-core' or 'npm install --save-dev playwright-core'
`)
}

View File

@ -1,6 +1,6 @@
import type { Nuxt, NuxtConfig } from '@nuxt/schema'
import type { ExecaChildProcess } from 'execa'
import type { Browser, LaunchOptions } from 'playwright'
import type { Browser, LaunchOptions } from 'playwright-core'
export type TestRunner = 'vitest' | 'jest'

View File

@ -107,7 +107,7 @@ importers:
pathe:
specifier: 1.1.1
version: 1.1.1
playwright:
playwright-core:
specifier: 1.35.1
version: 1.35.1
rimraf:
@ -130,7 +130,7 @@ importers:
version: 4.3.9(@types/node@18.16.19)
vitest:
specifier: 0.33.0
version: 0.33.0(playwright@1.35.1)
version: 0.33.0
vitest-environment-nuxt:
specifier: 0.8.7
version: 0.8.7(vitest@0.33.0)(vue-router@4.2.4)(vue@3.3.4)
@ -224,7 +224,7 @@ importers:
version: 4.3.9(@types/node@18.16.19)
vitest:
specifier: 0.33.0
version: 0.33.0(playwright@1.35.1)
version: 0.33.0
webpack:
specifier: 5.88.1
version: 5.88.1
@ -514,7 +514,7 @@ importers:
version: 4.3.9(@types/node@18.16.19)
vitest:
specifier: 0.33.0
version: 0.33.0(playwright@1.35.1)
version: 0.33.0
packages/schema:
dependencies:
@ -646,7 +646,7 @@ importers:
'@jest/globals':
specifier: 29.6.0
version: 29.6.0
playwright:
playwright-core:
specifier: 1.35.1
version: 1.35.1
unbuild:
@ -654,7 +654,7 @@ importers:
version: 1.2.1
vitest:
specifier: 0.33.0
version: 0.33.0(playwright@1.35.1)
version: 0.33.0
packages/vite:
dependencies:
@ -976,7 +976,7 @@ importers:
version: 1.1.1
vitest:
specifier: latest
version: 0.33.0(playwright@1.35.1)
version: 0.33.0
vue:
specifier: 3.3.4
version: 3.3.4
@ -6860,7 +6860,7 @@ packages:
perfect-debounce: 1.0.0
std-env: 3.3.3
vite: 4.3.9(@types/node@18.16.19)
vitest: 0.33.0(playwright@1.35.1)
vitest: 0.33.0
vitest-environment-nuxt: 0.8.7(vitest@0.33.0)(vue-router@4.2.4)(vue@3.3.4)
transitivePeerDependencies:
- '@vue/compiler-dom'
@ -7149,15 +7149,6 @@ packages:
hasBin: true
dev: true
/playwright@1.35.1:
resolution: {integrity: sha512-NbwBeGJLu5m7VGM0+xtlmLAH9VUfWwYOhUi/lSEDyGg46r1CA9RWlvoc5yywxR9AzQb0mOCm7bWtOXV7/w43ZA==}
engines: {node: '>=16'}
hasBin: true
requiresBuild: true
dependencies:
playwright-core: 1.35.1
dev: true
/pluralize@8.0.0:
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
engines: {node: '>=4'}
@ -8978,7 +8969,7 @@ packages:
magic-string: 0.30.1
ofetch: 1.1.1
unenv: 1.5.1
vitest: 0.33.0(playwright@1.35.1)
vitest: 0.33.0
vue: 3.3.4
vue-router: 4.2.4(vue@3.3.4)
transitivePeerDependencies:
@ -8986,7 +8977,7 @@ packages:
- '@vue/server-renderer'
dev: true
/vitest@0.33.0(playwright@1.35.1):
/vitest@0.33.0:
resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==}
engines: {node: '>=v14.18.0'}
hasBin: true
@ -9034,7 +9025,6 @@ packages:
magic-string: 0.30.1
pathe: 1.1.1
picocolors: 1.0.0
playwright: 1.35.1
std-env: 3.3.3
strip-literal: 1.0.1
tinybench: 2.5.0

View File

@ -1,6 +1,6 @@
import { Script, createContext } from 'node:vm'
import { expect } from 'vitest'
import type { Page } from 'playwright'
import type { Page } from 'playwright-core'
import { parse } from 'devalue'
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
import { createError } from 'h3'