-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathvitest.bundles.jschardet.config.ts
More file actions
31 lines (29 loc) · 1.03 KB
/
Copy pathvitest.bundles.jschardet.config.ts
File metadata and controls
31 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { defineConfig } from 'vitest/config';
import { playwright } from '@vitest/browser-playwright';
import { fileURLToPath } from 'node:url';
import { uint8arrayPlugin } from './scripts/lib/uint8array-plugin.js';
import { bundleRedirectPlugin } from './scripts/lib/bundle-redirect-plugin.js';
// Runs the public-API tests against dist/jschardet.esm.js (and
// dist/jschardet.js for the global build smoke test) in headless
// Chromium. Any src/* import is redirected to the ESM bundle so tests
// exercise the built artefact, not unbundled source.
const abs = (p: string) => fileURLToPath(new URL(p, import.meta.url));
export default defineConfig({
plugins: [
bundleRedirectPlugin({
srcDir: abs('./src'),
bundle: abs('./dist/jschardet.esm.js'),
}),
uint8arrayPlugin(),
],
test: {
globals: true,
include: ['tests/jschardet.test.ts', 'tests/jschardet.global.test.ts'],
browser: {
enabled: true,
provider: playwright(),
headless: true,
instances: [{ browser: 'chromium' }],
},
},
});