shoelace/web-test-runner.config.js

53 wiersze
1.5 KiB
JavaScript
Czysty Zwykły widok Historia

import { esbuildPlugin } from '@web/dev-server-esbuild';
import { globbySync } from 'globby';
2023-01-17 15:44:07 +00:00
import { playwrightLauncher } from '@web/test-runner-playwright';
export default {
rootDir: '.',
2023-01-04 14:58:56 +00:00
files: 'src/**/*.test.ts', // "default" group
2023-07-03 19:49:25 +00:00
concurrentBrowsers: 3,
nodeResolve: {
exportConditions: ['production', 'default']
},
2023-01-18 14:29:39 +00:00
testFramework: {
config: {
timeout: 3000,
retries: 1
}
},
2022-03-08 22:34:17 +00:00
plugins: [
esbuildPlugin({
ts: true,
2023-06-13 19:40:04 +00:00
target: 'es2020'
2022-03-08 22:34:17 +00:00
})
],
browsers: [
playwrightLauncher({ product: 'chromium' }),
// Firefox started failing randomly so we're temporarily disabling it here. This could be a rogue test, not really
// sure what's happening.
// playwrightLauncher({ product: 'firefox' }),
2023-11-17 19:03:22 +00:00
playwrightLauncher({ product: 'webkit' })
],
testRunnerHtml: testFramework => `
2022-04-08 12:56:05 +00:00
<html lang="en-US">
<head></head>
<body>
2023-06-13 19:40:04 +00:00
<link rel="stylesheet" href="dist/themes/light.css">
<script>
window.process = {env: { NODE_ENV: "production" }}
</script>
<script type="module" src="${testFramework}"></script>
</body>
</html>
`,
2023-01-04 14:58:56 +00:00
// Create a named group for every test file to enable running single tests. If a test file is `split-panel.test.ts`
// then you can run `npm run test -- --group split-panel` to run only that component's tests.
groups: globbySync('src/**/*.test.ts').map(path => {
const groupName = path.match(/^.*\/(?<fileName>.*)\.test\.ts/).groups.fileName;
return {
name: groupName,
files: path
};
})
};