refactor(packages): simplify vitest config (#12104)

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
This commit is contained in:
axel7083 2025-04-09 13:13:14 +02:00 committed by GitHub
parent d7693fc5f3
commit 6bbe2f7db1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 26 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023 Red Hat, Inc.
* Copyright (C) 2023-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,8 @@
import { chrome } from '../../.electron-vendors.cache.json';
import { join } from 'path';
import { builtinModules } from 'module';
import { coverageConfig } from '../../vitest-shared-extensions.config';
const PACKAGE_ROOT = __dirname;
const PACKAGE_NAME = 'api';
/**
* @type {import('vite').UserConfig}
@ -57,7 +55,9 @@ const config = {
reportCompressedSize: false,
},
test: {
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
environment: 'node',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
passWithNoTests: true,
},
};

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023-2024 Red Hat, Inc.
* Copyright (C) 2023-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -44,4 +44,9 @@ export default defineConfig({
emptyOutDir: true,
reportCompressedSize: false,
},
test: {
environment: 'node',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
passWithNoTests: true,
},
});

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023-2024 Red Hat, Inc.
* Copyright (C) 2023-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,8 @@
import { node } from '../../.electron-vendors.cache.json';
import { join } from 'path';
import { builtinModules } from 'module';
import { coverageConfig } from '../../vitest-shared-extensions.config';
const PACKAGE_ROOT = __dirname;
const PACKAGE_NAME = 'main';
/**
* @type {import('vite').UserConfig}
* @see https://vitejs.dev/config/
@ -67,7 +65,8 @@ const config = {
},
test: {
retry: 3, // Retries failing tests up to 3 times
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
environment: 'node',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
},
};

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023 Red Hat, Inc.
* Copyright (C) 2023-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@
import { chrome } from '../../.electron-vendors.cache.json';
import { join } from 'path';
import { builtinModules } from 'module';
import { coverageConfig } from '../../vitest-shared-extensions.config';
const PACKAGE_ROOT = __dirname;
const PACKAGE_NAME = 'preload-docker-extension';
@ -66,7 +65,8 @@ const config = {
reportCompressedSize: false,
},
test: {
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
environment: 'jsdom',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
},
};

View file

@ -19,10 +19,8 @@
import { chrome } from '../../.electron-vendors.cache.json';
import { join } from 'path';
import { builtinModules } from 'module';
import { coverageConfig } from '../../vitest-shared-extensions.config';
const PACKAGE_ROOT = __dirname;
const PACKAGE_NAME = 'preload-webview';
/**
* @type {import('vite').UserConfig}
@ -59,7 +57,7 @@ const config = {
},
test: {
environment: 'jsdom',
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
},
};

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2023 Red Hat, Inc.
* Copyright (C) 2023-2025 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,8 @@
import { chrome } from '../../.electron-vendors.cache.json';
import { join } from 'path';
import { builtinModules } from 'module';
import { coverageConfig } from '../../vitest-shared-extensions.config';
const PACKAGE_ROOT = __dirname;
const PACKAGE_NAME = 'preload';
/**
* @type {import('vite').UserConfig}
@ -66,7 +64,9 @@ const config = {
reportCompressedSize: false,
},
test: {
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
environment: 'jsdom',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
passWithNoTests: true,
},
};

View file

@ -23,12 +23,10 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
import { svelteTesting } from '@testing-library/svelte/vite';
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import { coverageConfig } from '../../vitest-shared-extensions.config';
import tailwindcss from '@tailwindcss/vite';
let filename = fileURLToPath(import.meta.url);
const PACKAGE_ROOT = path.dirname(filename);
const PACKAGE_NAME = 'renderer';
// https://vitejs.dev/config/
export default defineConfig({
@ -59,7 +57,6 @@ export default defineConfig({
deps: {
inline: ['moment'],
},
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
setupFiles: ['./vite.tests.setup.js'],
},
base: '',

View file

@ -23,12 +23,10 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
import { svelteTesting } from '@testing-library/svelte/vite';
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import { coverageConfig } from '../../vitest-shared-extensions.config';
import tailwindcss from '@tailwindcss/vite';
let filename = fileURLToPath(import.meta.url);
const PACKAGE_ROOT = path.dirname(filename);
const PACKAGE_NAME = 'ui';
// https://vitejs.dev/config/
export default defineConfig({
@ -48,7 +46,6 @@ export default defineConfig({
deps: {
inline: ['moment'],
},
...coverageConfig(PACKAGE_ROOT, PACKAGE_NAME),
},
base: '',
server: {

View file

@ -44,4 +44,9 @@ export default defineConfig({
emptyOutDir: true,
reportCompressedSize: false,
},
test: {
environment: 'node',
include: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
passWithNoTests: true,
},
});