diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 8d601e489..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "plugins": [ - "@typescript-eslint" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:prettier/recommended" - ], - "overrides": [{ - "files": ["**/*.test.tsx"], - "rules": { - "@typescript-eslint/no-empty-function": ["off"], - "@typescript-eslint/no-unsafe-assignment": ["off"], - "@typescript-eslint/no-explicit-any": ["off"] - } - }], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "tsconfig.json", - "sourceType": "module" - }, - "rules": { - "@typescript-eslint/brace-style": "error", - "@typescript-eslint/func-call-spacing": "error", - "@typescript-eslint/no-require-imports": "error", - "@typescript-eslint/no-unnecessary-qualifier": "error", - "@typescript-eslint/semi": "error", - "brace-style": "off", - "func-call-spacing": "off", - "max-len": ["warn", { "code": 100, "ignoreStrings": true }], - "semi": "off", - "no-nested-ternary": "error", - "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }] - } -} diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 680110f01..6ec54caa6 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -11,16 +11,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['16.x'] + node-version: ['20.x'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Cache Node.js modules - uses: actions/cache@v2 + uses: actions/cache@v4 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm @@ -35,16 +35,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['16.x'] + node-version: ['20.x'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Cache Node.js modules - uses: actions/cache@v2 + uses: actions/cache@v4 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm @@ -56,7 +56,7 @@ jobs: # `npm run coverage` is run tests with coverage flags, rather than repeating them here - run: npm run coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: name: frontend-coverage flags: frontend @@ -67,16 +67,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['16.x'] + node-version: ['20.x'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Cache Node.js modules - uses: actions/cache@v2 + uses: actions/cache@v4 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm diff --git a/.nvmrc b/.nvmrc index c818c7b00..ec09f38d1 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.15.0 \ No newline at end of file +20.17.0 \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index c84f67d83..04d9151ea 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ ruby 3.1.2 -nodejs 16.20.1 \ No newline at end of file +nodejs 20.17.0 \ No newline at end of file diff --git a/client/src/api/TestRunsApi.ts b/client/src/api/TestRunsApi.ts index d8b8916bc..a4ef03649 100644 --- a/client/src/api/TestRunsApi.ts +++ b/client/src/api/TestRunsApi.ts @@ -13,7 +13,7 @@ export function postTestRun( testSessionId: string, runnableType: RunnableType, runnableId: string, - inputs: TestInput[] + inputs: TestInput[], ): Promise { const postEndpoint = getApiEndpoint('/test_runs'); const postBody: CreateTestRunBody = { @@ -51,7 +51,7 @@ export function deleteTestRun(testRunId: string): Promise { export function getTestRunWithResults( testRunId: string, - time: string | null | undefined + time: string | null | undefined, ): Promise { let endpoint = getApiEndpoint(`/test_runs/${testRunId}?include_results=true`); if (time) { diff --git a/client/src/api/TestSessionApi.ts b/client/src/api/TestSessionApi.ts index af3d4751f..4a52b60c9 100644 --- a/client/src/api/TestSessionApi.ts +++ b/client/src/api/TestSessionApi.ts @@ -10,7 +10,7 @@ import { getApiEndpoint } from './infernoApiService'; export function getLastTestRun(test_session_id: string): Promise { const testSessionsEndpoint = getApiEndpoint( - '/test_sessions/' + test_session_id + '/last_test_run' + '/test_sessions/' + test_session_id + '/last_test_run', ); return fetch(testSessionsEndpoint) .then((response) => response.json()) @@ -31,7 +31,7 @@ export function getTestSession(test_session_id: string): Promise { const testSuiteIDParameter = { name: 'test_suite_id', value: testSuiteID }; const postEndpoint = getApiEndpoint('/test_sessions', [testSuiteIDParameter]); @@ -69,7 +69,7 @@ export function getTestSessionData(test_session_id: string): Promise { const endpoint = getApiEndpoint( - `/test_sessions/${test_session_id}/session_data/apply_preset?preset_id=${preset_id}` + `/test_sessions/${test_session_id}/session_data/apply_preset?preset_id=${preset_id}`, ); return fetch(endpoint, { method: 'PUT' }).then((response) => { diff --git a/client/src/components/App/Router.tsx b/client/src/components/App/Router.tsx index 7b51fa4e3..b12b1b0e4 100644 --- a/client/src/components/App/Router.tsx +++ b/client/src/components/App/Router.tsx @@ -38,6 +38,6 @@ export const router = (testSuites: TestSuite[]) => { element: , }, ], - { basename: `/${basePath || ''}` } + { basename: `/${basePath || ''}` }, ); }; diff --git a/client/src/components/App/__tests__/App.test.tsx b/client/src/components/App/__tests__/App.test.tsx index 8205bc0af..af63132e1 100644 --- a/client/src/components/App/__tests__/App.test.tsx +++ b/client/src/components/App/__tests__/App.test.tsx @@ -1,8 +1,7 @@ -import React from 'react'; -import { act } from 'react-dom/test-utils'; -import { render } from '@testing-library/react'; +import React, { act } from 'react'; +import { render, waitFor } from '@testing-library/react'; -import { vi } from 'vitest'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; import { SnackbarProvider } from 'notistack'; import ThemeProvider from 'components/ThemeProvider'; @@ -26,16 +25,19 @@ describe('The App Root Component', () => { it('sets Test Suite state on mount', async () => { const getTestSuites = vi.spyOn(testSuitesApi, 'getTestSuites'); getTestSuites.mockResolvedValue(testSuites); + await act(() => render( - - ) + , + ), ); - expect(getTestSuites).toBeCalledTimes(1); + await waitFor(() => { + expect(getTestSuites).toBeCalledTimes(1); + }); }); }); diff --git a/client/src/components/App/__tests__/Page.test.tsx b/client/src/components/App/__tests__/Page.test.tsx index 70150ee2a..1a801908e 100644 --- a/client/src/components/App/__tests__/Page.test.tsx +++ b/client/src/components/App/__tests__/Page.test.tsx @@ -3,6 +3,7 @@ import { RouterProvider, createMemoryRouter } from 'react-router-dom'; import { render /* , waitFor */ } from '@testing-library/react'; import { testSuites } from '~/components/App/__mocked_data__/mockData'; import Page from '../Page'; +import { describe, it } from 'vitest'; describe('The Page Component', () => { it('sets page title on render', /* async */ () => { diff --git a/client/src/components/Footer/__tests__/Footer.test.tsx b/client/src/components/Footer/__tests__/Footer.test.tsx index 6636bcdf8..48dd35b7f 100644 --- a/client/src/components/Footer/__tests__/Footer.test.tsx +++ b/client/src/components/Footer/__tests__/Footer.test.tsx @@ -3,12 +3,13 @@ import { render, screen } from '@testing-library/react'; import Footer from '..'; import ThemeProvider from 'components/ThemeProvider'; import { basePath } from '~/api/infernoApiService'; +import { expect, test } from 'vitest'; test('renders Inferno Footer', () => { render(