Skip to content

Commit

Permalink
chore: fix backend code coverage report
Browse files Browse the repository at this point in the history
Code coverage reports were including lots of files that aren't in the package.

As usual, my first step was to steal from the AI Lab extension! :) The fix is in
vitest.config.

Fixes podman-desktop#1321.

Signed-off-by: Tim deBoer <[email protected]>
  • Loading branch information
deboer-tim committed Feb 11, 2025
1 parent 904b25a commit e2ab98f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
11 changes: 4 additions & 7 deletions packages/backend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2024 Red Hat, Inc.
* Copyright (C) 2024-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.
Expand All @@ -16,8 +16,8 @@
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import {join} from 'path';
import {builtinModules} from 'module';
import { join } from 'path';
import { builtinModules } from 'module';

const PACKAGE_ROOT = __dirname;

Expand Down Expand Up @@ -47,10 +47,7 @@ const config = {
formats: ['cjs'],
},
rollupOptions: {
external: [
'@podman-desktop/api',
...builtinModules.flatMap(p => [p, `node:${p}`]),
],
external: ['@podman-desktop/api', ...builtinModules.flatMap(p => [p, `node:${p}`])],
output: {
entryFileNames: '[name].js',
},
Expand Down
7 changes: 4 additions & 3 deletions packages/backend/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2024 Red Hat, Inc.
* Copyright (C) 2024-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.
Expand Down Expand Up @@ -27,9 +27,10 @@ const config = {
coverage: {
provider: 'v8',
reporter: ['lcov', 'text'],
extension: '.ts',
},
},
resolve: {
},
resolve: {
alias: {
'@podman-desktop/api': path.resolve(__dirname, '__mocks__/@podman-desktop/api.js'),
'/@/': join(PACKAGE_ROOT, 'src') + '/',
Expand Down
8 changes: 3 additions & 5 deletions packages/frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (C) 2024 Red Hat, Inc.
* Copyright (C) 2024-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.
Expand All @@ -23,7 +23,7 @@ import { svelte } from '@sveltejs/vite-plugin-svelte';
import { svelteTesting } from '@testing-library/svelte/vite';
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import tailwindcss from '@tailwindcss/vite'
import tailwindcss from '@tailwindcss/vite';

let filename = fileURLToPath(import.meta.url);
const PACKAGE_ROOT = path.dirname(filename);
Expand All @@ -48,9 +48,7 @@ export default defineConfig({
environment: 'jsdom',
alias: [{ find: '@testing-library/svelte', replacement: '@testing-library/svelte/svelte5' }],
deps: {
inline: [

],
inline: [],
},
},
base: '',
Expand Down

0 comments on commit e2ab98f

Please sign in to comment.