0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/elements/web-test-runner.config.js

41 lines
1,004 B
JavaScript

import { fileURLToPath } from 'node:url';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { playwrightLauncher } from '@web/test-runner-playwright';
const config = {
files: ['src/**/*.test.ts'],
nodeResolve: {
exportConditions: ['development'],
},
plugins: [
esbuildPlugin({
ts: true,
tsconfig: fileURLToPath(new URL('tsconfig.json', import.meta.url)),
}),
// Transform SVG files into Lit templates
{
name: 'transform-svg',
transform(context) {
if (context.path.endsWith('.svg')) {
return {
body: `import { html } from 'lit';\nexport default html\`${context.body}\`;`,
headers: { 'content-type': 'application/javascript' },
};
}
},
},
],
browsers: [playwrightLauncher({ product: 'chromium' })],
testFramework: {
config: {
ui: 'tdd',
timeout: 5000,
},
},
coverageConfig: {
include: ['src/**/*.ts'],
},
};
export default config;