spiegel-keyman/common/predictive-text/unit_tests/in_browser/web-test-runner.config.mjs
2024-05-15 14:35:57 +07:00

50 lines
No EOL
1.6 KiB
JavaScript

// @ts-check
import { devices, playwrightLauncher } from '@web/test-runner-playwright';
import { defaultReporter, summaryReporter } from '@web/test-runner';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
import { sessionStabilityReporter } from '@keymanapp/common-test-resources/test-runner-stability-reporter.mjs';
const dir = dirname(fileURLToPath(import.meta.url));
const KEYMAN_ROOT = resolve(dir, '../../../../');
/** @type {import('@web/test-runner').TestRunnerConfig} */
export default {
browsers: [
playwrightLauncher({ product: 'chromium' }),
playwrightLauncher({ product: 'webkit', concurrency: 1 }),
playwrightLauncher({ product: 'firefox' })
],
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'})
],
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,
// debug: true,
rootDir: KEYMAN_ROOT // b/c that's where node_modules is
}