diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efc5a6849..48cacded8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: 20.x - name: Install dependencies run: npm install -g typescript codecov - name: Build diff --git a/app/server/tests/controllers/appsController.test.ts b/app/server/tests/controllers/appsController.test.ts index 0c27d2012..ac1fe9ccf 100644 --- a/app/server/tests/controllers/appsController.test.ts +++ b/app/server/tests/controllers/appsController.test.ts @@ -82,7 +82,8 @@ describe("appsController", () => { shareNotFound: "", mathjaxSrc, defaultLanguage: "en", - enableI18n: false + enableI18n: false, + hotReload: undefined }); expect(mockStatus).not.toBeCalled(); }); @@ -104,7 +105,8 @@ describe("appsController", () => { shareNotFound: "", mathjaxSrc, defaultLanguage: "en", - enableI18n: false + enableI18n: false, + hotReload: undefined }); }); @@ -130,7 +132,8 @@ describe("appsController", () => { shareNotFound: "", mathjaxSrc, defaultLanguage: "en", - enableI18n: false + enableI18n: false, + hotReload: undefined }); }); @@ -154,7 +157,8 @@ describe("appsController", () => { shareNotFound: "tiny-mouse", mathjaxSrc, defaultLanguage: "en", - enableI18n: false + enableI18n: false, + hotReload: undefined }); }); diff --git a/app/static/eslint.config.js b/app/static/eslint.config.js index a2ff07100..82b0022a4 100644 --- a/app/static/eslint.config.js +++ b/app/static/eslint.config.js @@ -29,6 +29,13 @@ export default [ } }, + { + files: ["**/tests/**/*.ts"], + rules: { + "vitest/expect-expect": "off" + } + }, + { ...pluginPlaywright.configs['flat/recommended'], files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'], diff --git a/app/static/translationPackage/tests/directive/translate.test.ts b/app/static/translationPackage/tests/directive/translate.test.ts index ee2d95aa5..bd82af056 100644 --- a/app/static/translationPackage/tests/directive/translate.test.ts +++ b/app/static/translationPackage/tests/directive/translate.test.ts @@ -3,14 +3,15 @@ import Vuex from "vuex"; import registerTranslations from "../../registerTranslations"; import translate from "../../directive/translate"; import { nextTick } from "vue"; +import { Mock } from "vitest"; describe("translate directive", () => { beforeAll(() => { - console.warn = jest.fn(); + console.warn = vi.fn(); }); afterAll(() => { - (console.warn as jest.Mock).mockClear(); + (console.warn as Mock).mockClear(); }); const TranslateAttributeTest = { @@ -243,7 +244,7 @@ describe("translate directive", () => { } }); expect(rendered.find("h4").text()).toBe(""); - expect((console.warn as jest.Mock).mock.calls[0][0]).toBe("v-translate directive declared without a value"); + expect((console.warn as Mock).mock.calls[0][0]).toBe("v-translate directive declared without a value"); }); it("removes watcher on unbind", async () => { diff --git a/app/static/translationPackage/tests/src/languageSwitcher.test.ts b/app/static/translationPackage/tests/src/languageSwitcher.test.ts index 0a5fd1b1b..4f5f2eff7 100644 --- a/app/static/translationPackage/tests/src/languageSwitcher.test.ts +++ b/app/static/translationPackage/tests/src/languageSwitcher.test.ts @@ -3,7 +3,7 @@ import { shallowMount, mount } from "@vue/test-utils"; import LanguageSwitcher from "../../src/LanguageSwitcher.vue"; describe("languageSwitcher component", () => { - const mockUpdateLanguage = jest.fn(); + const mockUpdateLanguage = vi.fn(); const createStore = (enableI18n: boolean) => { return new Vuex.Store({ diff --git a/app/static/translationPackage/tests/store/actions.test.ts b/app/static/translationPackage/tests/store/actions.test.ts index 713de81ea..d1697c5d1 100644 --- a/app/static/translationPackage/tests/store/actions.test.ts +++ b/app/static/translationPackage/tests/store/actions.test.ts @@ -20,8 +20,8 @@ describe("Language actions", () => { }); it("UpdateLanguage commits change language mutation and i18next function", async () => { - const commit = jest.fn(); - const spyChangeLanguage = jest.spyOn(i18next, "changeLanguage"); + const commit = vi.fn(); + const spyChangeLanguage = vi.spyOn(i18next, "changeLanguage"); await (actions[LanguageAction.UpdateLanguage] as any)({ commit }, "fr"); expect(commit).toBeCalledTimes(1); expect(commit.mock.calls[0][0]).toBe(LanguageStateMutation.ChangeLanguage);