shoelace/web-test-runner.config.js

41 wiersze
1.2 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
2021-12-07 21:46:05 +00:00
concurrentBrowsers: 3,
nodeResolve: true,
2022-03-08 22:34:17 +00:00
plugins: [
esbuildPlugin({
ts: true,
target: 'auto'
})
],
browsers: [
playwrightLauncher({ product: 'chromium' }),
playwrightLauncher({ product: 'firefox' }),
playwrightLauncher({ product: 'webkit' })
],
testRunnerHtml: testFramework => `
2022-04-08 12:56:05 +00:00
<html lang="en-US">
<head></head>
<body>
<link rel="stylesheet" href="dist/themes/light.css">
<script type="module" src="dist/shoelace.js"></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
};
})
};