replace jest with vitest
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -33,5 +33,9 @@ AdGuardHome.exe
|
|||||||
AdGuardHome.yaml*
|
AdGuardHome.yaml*
|
||||||
coverage.txt
|
coverage.txt
|
||||||
node_modules/
|
node_modules/
|
||||||
|
client/test-results/
|
||||||
|
client/playwright-report/
|
||||||
|
client/blob-report/
|
||||||
|
client/playwright/.cache/
|
||||||
|
|
||||||
!/build/gitkeep
|
!/build/gitkeep
|
||||||
|
|||||||
5
client/.gitignore
vendored
5
client/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
/test-results/
|
|
||||||
/playwright-report/
|
|
||||||
/blob-report/
|
|
||||||
/playwright/.cache/
|
|
||||||
6
client/jest.config.mjs
vendored
6
client/jest.config.mjs
vendored
@@ -1,6 +0,0 @@
|
|||||||
export default {
|
|
||||||
testEnvironment: 'jsdom',
|
|
||||||
transform: {
|
|
||||||
'^.+\\.tsx?$': 'babel-jest',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
8461
client/package-lock.json
generated
vendored
8461
client/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
8
client/package.json
vendored
8
client/package.json
vendored
@@ -10,8 +10,8 @@
|
|||||||
"lint": "echo 'Lint temporarily disabled'",
|
"lint": "echo 'Lint temporarily disabled'",
|
||||||
"lint-new": "eslint './src/**/*.(ts|tsx)'",
|
"lint-new": "eslint './src/**/*.(ts|tsx)'",
|
||||||
"lint:fix": "eslint './src/**/*.(ts|tsx)' --fix",
|
"lint:fix": "eslint './src/**/*.(ts|tsx)' --fix",
|
||||||
"test": "jest",
|
"test": "vitest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "vitest --watch",
|
||||||
"test:e2e": "npx playwright test tests/e2e",
|
"test:e2e": "npx playwright test tests/e2e",
|
||||||
"test:e2e:interactive": "npx playwright test --ui",
|
"test:e2e:interactive": "npx playwright test --ui",
|
||||||
"test:e2e:debug": "npx playwright test --debug",
|
"test:e2e:debug": "npx playwright test --debug",
|
||||||
@@ -66,7 +66,6 @@
|
|||||||
"@babel/preset-env": "^7.24.5",
|
"@babel/preset-env": "^7.24.5",
|
||||||
"@babel/preset-react": "^7.24.1",
|
"@babel/preset-react": "^7.24.1",
|
||||||
"@playwright/test": "^1.49.1",
|
"@playwright/test": "^1.49.1",
|
||||||
"@types/jest": "^29.5.12",
|
|
||||||
"@types/lodash": "^4.17.4",
|
"@types/lodash": "^4.17.4",
|
||||||
"@types/node": "^22.10.2",
|
"@types/node": "^22.10.2",
|
||||||
"@types/react": "^17.0.80",
|
"@types/react": "^17.0.80",
|
||||||
@@ -91,8 +90,6 @@
|
|||||||
"eslint-plugin-react-hooks": "^4.6.2",
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-webpack-plugin": "^5.6.0",
|
"html-webpack-plugin": "^5.6.0",
|
||||||
"jest": "^29.7.0",
|
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
|
||||||
"jscodeshift": "^0.15.2",
|
"jscodeshift": "^0.15.2",
|
||||||
"mini-css-extract-plugin": "^2.9.0",
|
"mini-css-extract-plugin": "^2.9.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
@@ -103,6 +100,7 @@
|
|||||||
"stylelint": "^16.5.0",
|
"stylelint": "^16.5.0",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
|
"vitest": "^3.0.4",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
"webpack-cli": "^5.1.4",
|
"webpack-cli": "^5.1.4",
|
||||||
"webpack-dev-server": "^5.0.4",
|
"webpack-dev-server": "^5.0.4",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { describe, expect, test, afterEach, vi, beforeEach, it } from 'vitest';
|
||||||
|
|
||||||
import { sortIp, countClientsStatistics, findAddressType, subnetMaskToBitMask } from '../helpers/helpers';
|
import { sortIp, countClientsStatistics, findAddressType, subnetMaskToBitMask } from '../helpers/helpers';
|
||||||
import { ADDRESS_TYPES } from '../helpers/constants';
|
import { ADDRESS_TYPES } from '../helpers/constants';
|
||||||
|
|
||||||
@@ -259,7 +261,7 @@ describe('sortIp', () => {
|
|||||||
const originalWarn = console.warn;
|
const originalWarn = console.warn;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
console.warn = jest.fn();
|
console.warn = vi.fn();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -347,15 +349,15 @@ describe('sortIp', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('findAddressType', () => {
|
describe('findAddressType', () => {
|
||||||
describe('ip', () => {
|
it('should return IP type for IP addresses', () => {
|
||||||
expect(findAddressType('127.0.0.1')).toStrictEqual(ADDRESS_TYPES.IP);
|
expect(findAddressType('127.0.0.1')).toStrictEqual(ADDRESS_TYPES.IP);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cidr', () => {
|
it('should return CIDR type for CIDR addresses', () => {
|
||||||
expect(findAddressType('127.0.0.1/8')).toStrictEqual(ADDRESS_TYPES.CIDR);
|
expect(findAddressType('127.0.0.1/8')).toStrictEqual(ADDRESS_TYPES.CIDR);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('mac', () => {
|
it('should return UNKNOWN type for MAC addresses', () => {
|
||||||
expect(findAddressType('00:1B:44:11:3A:B7')).toStrictEqual(ADDRESS_TYPES.UNKNOWN);
|
expect(findAddressType('00:1B:44:11:3A:B7')).toStrictEqual(ADDRESS_TYPES.UNKNOWN);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
8
client/vitest.config.ts
vendored
Normal file
8
client/vitest.config.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
environment: 'jsdom',
|
||||||
|
include: ['src/__tests__/**'],
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user