Configure Vitest for unit and browser tests (use @puppeteer/browsers and webdriverio)

This commit is contained in:
Hugo Alliaume
2025-08-16 19:17:43 +02:00
parent 5654f0d88d
commit 432487d0e2
8 changed files with 22 additions and 5 deletions

View File

@@ -17,7 +17,9 @@
"scripts": {
"build": "tsx ../../../bin/build_package.ts .",
"watch": "tsx ../../../bin/build_package.ts . --watch",
"test": "../../../bin/test_package.sh .",
"test": "pnpm run test:unit && pnpm run test:browser",
"test:unit": "../../../bin/test_package.sh . --unit",
"test:browser": "../../../bin/test_package.sh . --browser",
"check": "biome check",
"ci": "biome ci"
},

View File

@@ -0,0 +1,7 @@
import { describe, expect, it } from 'vitest';
describe('Placeholder', () => {
it('pass', () => {
expect(true).toBe(true);
});
});

View File

@@ -8,7 +8,7 @@
*/
import { describe, expect, test } from 'vitest';
import { format } from '../../src/formatters/formatter';
import { format } from '../../../src/formatters/formatter';
describe('Formatter', () => {
test.concurrent.each<[string, string, Record<string, string | number>]>([

View File

@@ -8,7 +8,7 @@
*/
import { describe, expect, test } from 'vitest';
import { formatIntl } from '../../src/formatters/intl-formatter';
import { formatIntl } from '../../../src/formatters/intl-formatter';
describe('Intl Formatter', () => {
test('format with named arguments', () => {

View File

@@ -7,7 +7,7 @@ import {
setLocaleFallbacks,
throwWhenNotFound,
trans,
} from '../src/translator_controller';
} from '../../src/translator_controller';
describe('Translator', () => {
beforeEach(() => {

View File

@@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest';
import { strtr } from '../src/utils';
import { strtr } from '../../src/utils';
describe('Utils', () => {
test.concurrent.each<[string, string, Record<string, string>]>([

View File

@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import configShared from '../../../vitest.config.browser.mjs';
export default mergeConfig(configShared, {});

View File

@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import configShared from '../../../vitest.config.unit.mjs';
export default mergeConfig(configShared, {});