Skip to content

Commit

Permalink
Fixed vitest globals
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Oct 14, 2023
1 parent 1b0d3a0 commit a8a7353
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { act, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { vi } from 'vitest';
import App from './App';
import { AUTH_CHECK_INTERVAL } from './config';
import { render } from './testing';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { AnyAction, createAsyncThunk } from '@reduxjs/toolkit';
import configureStore from 'redux-mock-store';
import thunk, { ThunkDispatch } from 'redux-thunk';
import { vi } from 'vitest';
import { createApiCallAsyncThunk, createAsyncThunkMatcher } from '../reduxToolkitExtensions';

type TestRecord = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, waitForElementToBeRemoved, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { vi } from 'vitest';
import { render } from 'src/testing';
import { MealType, NoteCreateEdit } from '../../models';
import NoteCreateEditDialog from './NoteCreateEditDialog';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { vi } from 'vitest';
import { create } from 'src/test-utils';
import { PageCreateEdit } from '../../models';
import PageCreateEditDialog from './PageCreateEditDialog';
Expand Down
16 changes: 11 additions & 5 deletions src/frontend/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ beforeAll(() => {
dispatchEvent: () => false,
}),
});
});

beforeAll(() => server.listen());
server.listen();
});

beforeEach(() => initializeDb());
beforeEach(() => {
initializeDb();
});

afterEach(() => server.resetHandlers());
afterEach(() => {
server.resetHandlers();
});

afterAll(() => server.close());
afterAll(() => {
server.close();
});
3 changes: 2 additions & 1 deletion src/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"noEmit": true,
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true,
"baseUrl": "."
"baseUrl": ".",
"types": ["vitest/globals"]
},
"include": [
"src"
Expand Down

0 comments on commit a8a7353

Please sign in to comment.