mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-14 04:39:23 +00:00
62 lines
No EOL
2.1 KiB
JavaScript
62 lines
No EOL
2.1 KiB
JavaScript
// @ts-check
|
|
import { devices, playwrightLauncher } from '@web/test-runner-playwright';
|
|
import { esbuildPlugin } from '@web/dev-server-esbuild';
|
|
import { defaultReporter, summaryReporter } from '@web/test-runner';
|
|
import { LauncherWrapper, sessionStabilityReporter } from '@keymanapp/common-test-resources/test-runner-stability-reporter.mjs';
|
|
import { importMapsPlugin } from '@web/dev-server-import-maps';
|
|
import { dirname, resolve } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
const KEYMAN_ROOT = resolve(dir, '../../../../..');
|
|
|
|
/** @type {import('@web/test-runner').TestRunnerConfig} */
|
|
export default {
|
|
// debug: true,
|
|
browsers: [
|
|
new LauncherWrapper(playwrightLauncher({ product: 'chromium' })),
|
|
new LauncherWrapper(playwrightLauncher({ product: 'firefox' })),
|
|
new LauncherWrapper(playwrightLauncher({ product: 'webkit', concurrency: 1 })),
|
|
],
|
|
concurrency: 10,
|
|
nodeResolve: true,
|
|
files: [
|
|
'**/*.spec.ts'
|
|
],
|
|
middleware: [
|
|
// Rewrites short-hand paths for test resources, making them fully relative to the repo root.
|
|
function rewriteResourcePath(context, next) {
|
|
if(context.url.startsWith('/resources/')) {
|
|
context.url = '/common/test' + context.url;
|
|
}
|
|
|
|
return next();
|
|
}
|
|
],
|
|
plugins: [
|
|
esbuildPlugin({ts: true, target: 'auto'}),
|
|
importMapsPlugin({
|
|
inject: {
|
|
importMap: {
|
|
// Redirects `eventemitter3` imports to the bundled ESM library. The standard import is an
|
|
// ESM wrapper around the CommonJS implementation, and WTR fails when it hits the CommonJS.
|
|
imports: {
|
|
'eventemitter3': '/node_modules/eventemitter3/dist/eventemitter3.esm.js'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
],
|
|
reporters: [
|
|
summaryReporter({}), /* local-dev mocha-style */
|
|
sessionStabilityReporter({}),
|
|
defaultReporter({})
|
|
],
|
|
/*
|
|
Un-comment the next two lines for easy interactive debugging; it'll launch the
|
|
test page in your preferred browser.
|
|
*/
|
|
// open: true,
|
|
// manual: true,
|
|
rootDir: KEYMAN_ROOT
|
|
} |