2021-05-27 21:52:19 +00:00
|
|
|
import { esbuildPlugin } from '@web/dev-server-esbuild';
|
2022-01-16 05:47:14 +00:00
|
|
|
import { globbySync } from 'globby';
|
2023-01-17 15:44:07 +00:00
|
|
|
import { playwrightLauncher } from '@web/test-runner-playwright';
|
2021-05-27 21:52:19 +00:00
|
|
|
|
|
|
|
export default {
|
2022-01-16 05:47:14 +00:00
|
|
|
rootDir: '.',
|
2023-01-04 14:58:56 +00:00
|
|
|
files: 'src/**/*.test.ts', // "default" group
|
2023-04-13 15:58:46 +00:00
|
|
|
concurrentBrowsers: 1,
|
2022-01-16 05:47:14 +00:00
|
|
|
nodeResolve: true,
|
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,
|
|
|
|
target: 'auto'
|
|
|
|
})
|
|
|
|
],
|
2022-01-16 05:47:14 +00:00
|
|
|
browsers: [
|
|
|
|
playwrightLauncher({ product: 'chromium' }),
|
|
|
|
playwrightLauncher({ product: 'firefox' }),
|
|
|
|
playwrightLauncher({ product: 'webkit' })
|
|
|
|
],
|
2021-05-27 21:52:19 +00:00
|
|
|
testRunnerHtml: testFramework => `
|
2022-04-08 12:56:05 +00:00
|
|
|
<html lang="en-US">
|
2021-05-27 21:52:19 +00:00
|
|
|
<head></head>
|
|
|
|
<body>
|
2023-06-12 15:18:24 +00:00
|
|
|
<link rel="stylesheet" href="cdn/themes/light.css">
|
|
|
|
<script type="module" src="cdn/shoelace.js"></script>
|
2021-05-27 21:52:19 +00:00
|
|
|
<script type="module" src="${testFramework}"></script>
|
|
|
|
</body>
|
|
|
|
</html>
|
2022-01-16 05:47:14 +00:00
|
|
|
`,
|
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.
|
2022-01-16 05:47:14 +00:00
|
|
|
groups: globbySync('src/**/*.test.ts').map(path => {
|
|
|
|
const groupName = path.match(/^.*\/(?<fileName>.*)\.test\.ts/).groups.fileName;
|
|
|
|
return {
|
|
|
|
name: groupName,
|
|
|
|
files: path
|
|
|
|
};
|
|
|
|
})
|
2021-05-27 21:52:19 +00:00
|
|
|
};
|