-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dynamic import retry plugin [KM-865]
- Loading branch information
Showing
27 changed files
with
2,065 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,6 @@ dist | |
|
||
# Local History | ||
.history | ||
|
||
playground-temp | ||
temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import os from 'node:os' | ||
import path from 'node:path' | ||
import fs from 'fs-extra' | ||
import type { BrowserServer } from 'playwright-chromium' | ||
import { chromium } from 'playwright-chromium' | ||
|
||
const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup') | ||
|
||
let browserServer: BrowserServer | undefined | ||
|
||
export async function setup(): Promise<void> { | ||
browserServer = await chromium.launchServer({ | ||
headless: !process.env.VITE_DEBUG_SERVE, | ||
args: process.env.CI | ||
? ['--no-sandbox', '--disable-setuid-sandbox'] | ||
: undefined, | ||
}) | ||
|
||
await fs.mkdirp(DIR) | ||
await fs.writeFile(path.join(DIR, 'wsEndpoint'), browserServer.wsEndpoint()) | ||
|
||
const tempDir = path.resolve(__dirname, '../playground-temp') | ||
await fs.ensureDir(tempDir) | ||
await fs.emptyDir(tempDir) | ||
await fs | ||
.copy(path.resolve(__dirname, '../playground'), tempDir, { | ||
dereference: false, | ||
filter(file) { | ||
file = file.replace(/\\/g, '/') | ||
return !file.includes('__tests__') && !file.match(/dist(\/|$)/) | ||
}, | ||
}) | ||
.catch(async (error) => { | ||
if (error.code === 'EPERM' && error.syscall === 'symlink') { | ||
throw new Error( | ||
'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.', | ||
) | ||
} else { | ||
throw error | ||
} | ||
}) | ||
} | ||
|
||
export async function teardown(): Promise<void> { | ||
await browserServer?.close() | ||
if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) { | ||
fs.removeSync(path.resolve(__dirname, '../playground-temp')) | ||
} | ||
} |
Oops, something went wrong.