mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(test-utils): export from core playwright package (#22122)
This commit is contained in:
parent
4abfb40a78
commit
b06ae969f6
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -214,8 +214,7 @@ jobs:
|
|||||||
${{ runner.os }}-playwright-bin-v1-
|
${{ runner.os }}-playwright-bin-v1-
|
||||||
|
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
|
run: pnpm playwright-core install chromium
|
||||||
run: pnpm playwright install chromium
|
|
||||||
|
|
||||||
- name: Restore dist cache
|
- name: Restore dist cache
|
||||||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
"nuxt-vitest": "0.8.7",
|
"nuxt-vitest": "0.8.7",
|
||||||
"ofetch": "1.1.1",
|
"ofetch": "1.1.1",
|
||||||
"pathe": "1.1.1",
|
"pathe": "1.1.1",
|
||||||
"playwright": "1.35.1",
|
"playwright-core": "1.35.1",
|
||||||
"rimraf": "5.0.1",
|
"rimraf": "5.0.1",
|
||||||
"semver": "7.5.3",
|
"semver": "7.5.3",
|
||||||
"std-env": "3.3.3",
|
"std-env": "3.3.3",
|
||||||
|
@ -34,13 +34,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest/globals": "29.6.0",
|
"@jest/globals": "29.6.0",
|
||||||
"playwright": "1.35.1",
|
"playwright-core": "1.35.1",
|
||||||
"unbuild": "latest",
|
"unbuild": "latest",
|
||||||
"vitest": "0.33.0"
|
"vitest": "0.33.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@jest/globals": "^29.5.0",
|
"@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",
|
"vitest": "^0.30.0 || ^0.31.0 || ^0.32.0 || ^0.33.0",
|
||||||
"vue": "^3.3.4"
|
"vue": "^3.3.4"
|
||||||
},
|
},
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"@jest/globals": {
|
"@jest/globals": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"playwright": {
|
"playwright-core": {
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"vitest": {
|
"vitest": {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import type { Browser, BrowserContextOptions } from 'playwright'
|
import type { Browser, BrowserContextOptions } from 'playwright-core'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
import { url } from './server'
|
import { url } from './server'
|
||||||
|
|
||||||
export async function createBrowser () {
|
export async function createBrowser () {
|
||||||
const ctx = useTestContext()
|
const ctx = useTestContext()
|
||||||
|
|
||||||
let playwright: typeof import('playwright')
|
let playwright: typeof import('playwright-core')
|
||||||
try {
|
try {
|
||||||
// Workaround for https://github.com/nuxt/nuxt/issues/13441
|
// Workaround for https://github.com/nuxt/nuxt/issues/13441
|
||||||
// TODO: Remove when upstream issue resolved
|
// TODO: Remove when upstream issue resolved
|
||||||
playwright = await import(String('playwright'))
|
playwright = await import(String('playwright-core'))
|
||||||
} catch {
|
} catch {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
throw new Error(`
|
throw new Error(`
|
||||||
The dependency 'playwright' not found.
|
The dependency 'playwright-core' not found.
|
||||||
Please run 'yarn add --dev playwright' or 'npm install --save-dev playwright'
|
Please run 'yarn add --dev playwright-core' or 'npm install --save-dev playwright-core'
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { Nuxt, NuxtConfig } from '@nuxt/schema'
|
import type { Nuxt, NuxtConfig } from '@nuxt/schema'
|
||||||
import type { ExecaChildProcess } from 'execa'
|
import type { ExecaChildProcess } from 'execa'
|
||||||
import type { Browser, LaunchOptions } from 'playwright'
|
import type { Browser, LaunchOptions } from 'playwright-core'
|
||||||
|
|
||||||
export type TestRunner = 'vitest' | 'jest'
|
export type TestRunner = 'vitest' | 'jest'
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ importers:
|
|||||||
pathe:
|
pathe:
|
||||||
specifier: 1.1.1
|
specifier: 1.1.1
|
||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
playwright:
|
playwright-core:
|
||||||
specifier: 1.35.1
|
specifier: 1.35.1
|
||||||
version: 1.35.1
|
version: 1.35.1
|
||||||
rimraf:
|
rimraf:
|
||||||
@ -130,7 +130,7 @@ importers:
|
|||||||
version: 4.3.9(@types/node@18.16.19)
|
version: 4.3.9(@types/node@18.16.19)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: 0.33.0
|
specifier: 0.33.0
|
||||||
version: 0.33.0(playwright@1.35.1)
|
version: 0.33.0
|
||||||
vitest-environment-nuxt:
|
vitest-environment-nuxt:
|
||||||
specifier: 0.8.7
|
specifier: 0.8.7
|
||||||
version: 0.8.7(vitest@0.33.0)(vue-router@4.2.4)(vue@3.3.4)
|
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)
|
version: 4.3.9(@types/node@18.16.19)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: 0.33.0
|
specifier: 0.33.0
|
||||||
version: 0.33.0(playwright@1.35.1)
|
version: 0.33.0
|
||||||
webpack:
|
webpack:
|
||||||
specifier: 5.88.1
|
specifier: 5.88.1
|
||||||
version: 5.88.1
|
version: 5.88.1
|
||||||
@ -514,7 +514,7 @@ importers:
|
|||||||
version: 4.3.9(@types/node@18.16.19)
|
version: 4.3.9(@types/node@18.16.19)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: 0.33.0
|
specifier: 0.33.0
|
||||||
version: 0.33.0(playwright@1.35.1)
|
version: 0.33.0
|
||||||
|
|
||||||
packages/schema:
|
packages/schema:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -646,7 +646,7 @@ importers:
|
|||||||
'@jest/globals':
|
'@jest/globals':
|
||||||
specifier: 29.6.0
|
specifier: 29.6.0
|
||||||
version: 29.6.0
|
version: 29.6.0
|
||||||
playwright:
|
playwright-core:
|
||||||
specifier: 1.35.1
|
specifier: 1.35.1
|
||||||
version: 1.35.1
|
version: 1.35.1
|
||||||
unbuild:
|
unbuild:
|
||||||
@ -654,7 +654,7 @@ importers:
|
|||||||
version: 1.2.1
|
version: 1.2.1
|
||||||
vitest:
|
vitest:
|
||||||
specifier: 0.33.0
|
specifier: 0.33.0
|
||||||
version: 0.33.0(playwright@1.35.1)
|
version: 0.33.0
|
||||||
|
|
||||||
packages/vite:
|
packages/vite:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -976,7 +976,7 @@ importers:
|
|||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
vitest:
|
vitest:
|
||||||
specifier: latest
|
specifier: latest
|
||||||
version: 0.33.0(playwright@1.35.1)
|
version: 0.33.0
|
||||||
vue:
|
vue:
|
||||||
specifier: 3.3.4
|
specifier: 3.3.4
|
||||||
version: 3.3.4
|
version: 3.3.4
|
||||||
@ -6860,7 +6860,7 @@ packages:
|
|||||||
perfect-debounce: 1.0.0
|
perfect-debounce: 1.0.0
|
||||||
std-env: 3.3.3
|
std-env: 3.3.3
|
||||||
vite: 4.3.9(@types/node@18.16.19)
|
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)
|
vitest-environment-nuxt: 0.8.7(vitest@0.33.0)(vue-router@4.2.4)(vue@3.3.4)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@vue/compiler-dom'
|
- '@vue/compiler-dom'
|
||||||
@ -7149,15 +7149,6 @@ packages:
|
|||||||
hasBin: true
|
hasBin: true
|
||||||
dev: 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:
|
/pluralize@8.0.0:
|
||||||
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@ -8978,7 +8969,7 @@ packages:
|
|||||||
magic-string: 0.30.1
|
magic-string: 0.30.1
|
||||||
ofetch: 1.1.1
|
ofetch: 1.1.1
|
||||||
unenv: 1.5.1
|
unenv: 1.5.1
|
||||||
vitest: 0.33.0(playwright@1.35.1)
|
vitest: 0.33.0
|
||||||
vue: 3.3.4
|
vue: 3.3.4
|
||||||
vue-router: 4.2.4(vue@3.3.4)
|
vue-router: 4.2.4(vue@3.3.4)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@ -8986,7 +8977,7 @@ packages:
|
|||||||
- '@vue/server-renderer'
|
- '@vue/server-renderer'
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vitest@0.33.0(playwright@1.35.1):
|
/vitest@0.33.0:
|
||||||
resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==}
|
resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==}
|
||||||
engines: {node: '>=v14.18.0'}
|
engines: {node: '>=v14.18.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -9034,7 +9025,6 @@ packages:
|
|||||||
magic-string: 0.30.1
|
magic-string: 0.30.1
|
||||||
pathe: 1.1.1
|
pathe: 1.1.1
|
||||||
picocolors: 1.0.0
|
picocolors: 1.0.0
|
||||||
playwright: 1.35.1
|
|
||||||
std-env: 3.3.3
|
std-env: 3.3.3
|
||||||
strip-literal: 1.0.1
|
strip-literal: 1.0.1
|
||||||
tinybench: 2.5.0
|
tinybench: 2.5.0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Script, createContext } from 'node:vm'
|
import { Script, createContext } from 'node:vm'
|
||||||
import { expect } from 'vitest'
|
import { expect } from 'vitest'
|
||||||
import type { Page } from 'playwright'
|
import type { Page } from 'playwright-core'
|
||||||
import { parse } from 'devalue'
|
import { parse } from 'devalue'
|
||||||
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
|
import { reactive, ref, shallowReactive, shallowRef } from 'vue'
|
||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
|
Loading…
Reference in New Issue
Block a user