@lvce-editor/test-with-playwright-worker 22.38.4 → 22.38.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coverageWorkerMain.js +2 -2
- package/dist/workerMain.js +66 -35
- package/package.json +1 -1
|
@@ -509,7 +509,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
509
509
|
}
|
|
510
510
|
};
|
|
511
511
|
const restoreMessageError = (error, _currentStack) => {
|
|
512
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
512
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
513
513
|
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
514
514
|
Object.defineProperty(restoredError, 'code', {
|
|
515
515
|
configurable: true,
|
|
@@ -597,7 +597,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
597
597
|
data: {
|
|
598
598
|
code: prettyError.code ?? error?.code,
|
|
599
599
|
codeFrame: prettyError.codeFrame,
|
|
600
|
-
name: prettyError.name,
|
|
600
|
+
name: prettyError.name ?? error?.name,
|
|
601
601
|
stack: getStack(prettyError),
|
|
602
602
|
type: getErrorType(prettyError)
|
|
603
603
|
},
|
package/dist/workerMain.js
CHANGED
|
@@ -770,7 +770,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
772
|
const restoreMessageError = (error, _currentStack) => {
|
|
773
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
773
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
774
774
|
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
775
775
|
Object.defineProperty(restoredError, 'code', {
|
|
776
776
|
configurable: true,
|
|
@@ -858,7 +858,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
858
858
|
data: {
|
|
859
859
|
code: prettyError.code ?? error?.code,
|
|
860
860
|
codeFrame: prettyError.codeFrame,
|
|
861
|
-
name: prettyError.name,
|
|
861
|
+
name: prettyError.name ?? error?.name,
|
|
862
862
|
stack: getStack(prettyError),
|
|
863
863
|
type: getErrorType(prettyError)
|
|
864
864
|
},
|
|
@@ -2314,21 +2314,40 @@ const startBrowser = async ({
|
|
|
2314
2314
|
await patchPlaywrightFirefoxWorkerWebSocket();
|
|
2315
2315
|
}
|
|
2316
2316
|
const launcher = await getLauncher(browser);
|
|
2317
|
-
|
|
2317
|
+
signal.throwIfAborted();
|
|
2318
|
+
const options = {
|
|
2318
2319
|
args: getBrowserLaunchArgs(browser),
|
|
2319
2320
|
headless
|
|
2320
|
-
});
|
|
2321
|
-
const page = await browserInstance.newPage();
|
|
2322
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
2323
|
-
signal.addEventListener('abort', async () => {
|
|
2324
|
-
await page.close();
|
|
2325
|
-
await browserInstance.close();
|
|
2326
|
-
});
|
|
2327
|
-
// @ts-ignore
|
|
2328
|
-
return {
|
|
2329
|
-
browser: browserInstance,
|
|
2330
|
-
page
|
|
2331
2321
|
};
|
|
2322
|
+
// Chromium 153 crashes when restoring OPFS handles from its in-memory IndexedDB backend.
|
|
2323
|
+
// An empty userDataDir gives each run a temporary disk-backed profile managed by Playwright.
|
|
2324
|
+
const browserInstance = browser === 'chromium' ? await launcher.launchPersistentContext('', options) : await launcher.launch(options);
|
|
2325
|
+
let disposal;
|
|
2326
|
+
const dispose = () => {
|
|
2327
|
+
signal.removeEventListener('abort', handleAbort);
|
|
2328
|
+
disposal ||= browserInstance.close();
|
|
2329
|
+
return disposal;
|
|
2330
|
+
};
|
|
2331
|
+
const handleAbort = () => {
|
|
2332
|
+
// The caller awaits disposal during teardown, including any cleanup error.
|
|
2333
|
+
void dispose().catch(() => {});
|
|
2334
|
+
};
|
|
2335
|
+
signal.addEventListener('abort', handleAbort, {
|
|
2336
|
+
once: true
|
|
2337
|
+
});
|
|
2338
|
+
try {
|
|
2339
|
+
signal.throwIfAborted();
|
|
2340
|
+
const page = await browserInstance.newPage();
|
|
2341
|
+
signal.throwIfAborted();
|
|
2342
|
+
return {
|
|
2343
|
+
browser: browserInstance,
|
|
2344
|
+
dispose,
|
|
2345
|
+
page
|
|
2346
|
+
};
|
|
2347
|
+
} catch (error) {
|
|
2348
|
+
await dispose();
|
|
2349
|
+
throw error;
|
|
2350
|
+
}
|
|
2332
2351
|
};
|
|
2333
2352
|
|
|
2334
2353
|
const getServerArgs = link => {
|
|
@@ -2391,29 +2410,36 @@ const setupTests = async ({
|
|
|
2391
2410
|
const port = await getPort();
|
|
2392
2411
|
const {
|
|
2393
2412
|
browser: browserInstance,
|
|
2413
|
+
dispose,
|
|
2394
2414
|
page
|
|
2395
2415
|
} = await startBrowser({
|
|
2396
2416
|
browser,
|
|
2397
2417
|
headless,
|
|
2398
2418
|
signal
|
|
2399
2419
|
});
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
link
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2420
|
+
try {
|
|
2421
|
+
const resolvedServerPath = await getServerPath(serverPath);
|
|
2422
|
+
const child = await startServer({
|
|
2423
|
+
...(link && link.length > 0 && {
|
|
2424
|
+
link
|
|
2425
|
+
}),
|
|
2426
|
+
onlyExtension,
|
|
2427
|
+
port,
|
|
2428
|
+
serverPath: resolvedServerPath,
|
|
2429
|
+
signal,
|
|
2430
|
+
testPath
|
|
2431
|
+
});
|
|
2432
|
+
return {
|
|
2433
|
+
browser: browserInstance,
|
|
2434
|
+
child,
|
|
2435
|
+
dispose,
|
|
2436
|
+
page,
|
|
2437
|
+
port
|
|
2438
|
+
};
|
|
2439
|
+
} catch (error) {
|
|
2440
|
+
await dispose();
|
|
2441
|
+
throw error;
|
|
2442
|
+
}
|
|
2417
2443
|
};
|
|
2418
2444
|
|
|
2419
2445
|
const getProcessEnv = () => {
|
|
@@ -2659,6 +2685,7 @@ const runAllTests = async (extensionPath, testPath, cwd, browser, headless, time
|
|
|
2659
2685
|
}
|
|
2660
2686
|
const {
|
|
2661
2687
|
child,
|
|
2688
|
+
dispose,
|
|
2662
2689
|
page,
|
|
2663
2690
|
port
|
|
2664
2691
|
} = await setupTests({
|
|
@@ -2727,10 +2754,14 @@ const runAllTests = async (extensionPath, testPath, cwd, browser, headless, time
|
|
|
2727
2754
|
}
|
|
2728
2755
|
});
|
|
2729
2756
|
} finally {
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2757
|
+
try {
|
|
2758
|
+
await tearDownTests({
|
|
2759
|
+
child,
|
|
2760
|
+
controller
|
|
2761
|
+
});
|
|
2762
|
+
} finally {
|
|
2763
|
+
await dispose();
|
|
2764
|
+
}
|
|
2734
2765
|
}
|
|
2735
2766
|
};
|
|
2736
2767
|
|