diff --git a/app/__mocks__/axios-progress-bar.ts b/app/__mocks__/axios-progress-bar.ts deleted file mode 100644 index 2b3d7f6b4..000000000 --- a/app/__mocks__/axios-progress-bar.ts +++ /dev/null @@ -1 +0,0 @@ -export function loadProgressBar() {} diff --git a/app/portainer/services/notifications.test.ts b/app/portainer/services/notifications.test.ts index 8eca2cf4a..01d85aecc 100644 --- a/app/portainer/services/notifications.test.ts +++ b/app/portainer/services/notifications.test.ts @@ -2,7 +2,6 @@ import toastr from 'toastr'; import { notifyError, notifySuccess, notifyWarning } from './notifications'; -vi.mock('toastr'); vi.spyOn(console, 'error').mockImplementation(() => vi.fn()); afterEach(() => { diff --git a/app/setup-tests/global-setup.js b/app/setup-tests/global-setup.js deleted file mode 100644 index d38e2dd9a..000000000 --- a/app/setup-tests/global-setup.js +++ /dev/null @@ -1,5 +0,0 @@ -import 'regenerator-runtime/runtime'; - -export default function setupTests() { - // pass -} diff --git a/app/setup-tests/stub-modules.ts b/app/setup-tests/stub-modules.ts new file mode 100644 index 000000000..02026c70e --- /dev/null +++ b/app/setup-tests/stub-modules.ts @@ -0,0 +1,8 @@ +// this file takes care of stubbing modules that are not tested, like +// axios-progress-bar +// toastr + +vi.mock('toastr'); +vi.mock('axios-progress-bar', () => ({ + loadProgressBar() {}, +})); diff --git a/vitest.config.mts b/vitest.config.mts index 8ff6ebb4e..3f97eebe1 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -7,10 +7,7 @@ export default defineConfig({ test: { globals: true, environment: 'jsdom', - setupFiles: [ - './app/setup-tests/global-setup.js', - './app/setup-tests/setup-msw.ts', - ], + setupFiles: ['./app/setup-tests/setup-msw.ts', './app/setup-tests/stub-modules.ts'], coverage: { reporter: ['text', 'html'], exclude: ['node_modules/', 'app/setup-tests/global-setup.js'], diff --git a/yarn.lock b/yarn.lock index 91cf67a21..3fb21edc6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7863,30 +7863,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001181: - version "1.0.30001451" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001451.tgz" - integrity sha512-XY7UbUpGRatZzoRft//5xOa69/1iGJRBlrieH6QYrkKLIFn3m7OVEJ81dSrKoy2BnKsdbX5cLrOispZNYo9v2w== - -caniuse-lite@^1.0.30001449: - version "1.0.30001487" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz#d882d1a34d89c11aea53b8cdc791931bdab5fe1b" - integrity sha512-83564Z3yWGqXsh2vaH/mhXfEM0wX+NlBCm1jYHOb97TrTWJEmPTccZgeLTPBUUb0PNVo+oomb7wkimZBIERClA== - -caniuse-lite@^1.0.30001503: - version "1.0.30001515" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz#418aefeed9d024cd3129bfae0ccc782d4cb8f12b" - integrity sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA== - -caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001541: - version "1.0.30001543" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001543.tgz#478a3e9dddbb353c5ab214b0ecb0dbed529ed1d8" - integrity sha512-qxdO8KPWPQ+Zk6bvNpPeQIOH47qZSYdFZd6dXQzb2KzhnSXju4Kd7H1PkSJx6NICSMgo/IhRZRhhfPTHYpJUCA== - -caniuse-lite@^1.0.30001565: - version "1.0.30001572" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001572.tgz#1ccf7dc92d2ee2f92ed3a54e11b7b4a3041acfa0" - integrity sha512-1Pbh5FLmn5y4+QhNyJE9j3/7dK44dGB83/ZMjv/qJk86TvDbjk0LosiZo0i0WB0Vx607qMX9jYrn1VLHCkN4rw== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001181, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001503, caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001541, caniuse-lite@^1.0.30001565: + version "1.0.30001579" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz" + integrity sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA== capital-case@^1.0.4: version "1.0.4"