feat: update_vitest_version to 2.0.0
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
8b3b74a972
commit
099c613ccc
|
@ -51,7 +51,7 @@
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^2.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20 || ^18 || ^16",
|
"node": "^20 || ^18 || ^16",
|
||||||
|
|
668
pnpm-lock.yaml
668
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import axios from 'axios';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
|
import ClaimPhoto from 'pages/Claim/Card/ClaimPhoto.vue';
|
||||||
|
|
||||||
describe('ClaimPhoto', () => {
|
describe('ClaimPhoto', () => {
|
||||||
let vm;
|
let vm;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe('ClaimPhoto', () => {
|
||||||
title: 'This file will be deleted',
|
title: 'This file will be deleted',
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
data: { index: 1 },
|
data: { index: 1 },
|
||||||
promise: vm.deleteDms
|
promise: vm.deleteDms,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import Login from 'pages/Login/LoginMain.vue';
|
import Login from 'pages/Login/LoginMain.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
describe('Login', () => {
|
describe('Login', () => {
|
||||||
let vm;
|
let vm;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { createTestingPinia } from '@pinia/testing';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import { i18n } from 'src/boot/i18n';
|
import { i18n } from 'src/boot/i18n';
|
||||||
import { Notify, Dialog } from 'quasar';
|
import { Notify, Dialog } from 'quasar';
|
||||||
import axios from 'axios';
|
|
||||||
import * as useValidator from 'src/composables/useValidator';
|
import * as useValidator from 'src/composables/useValidator';
|
||||||
|
|
||||||
installQuasarPlugin({
|
installQuasarPlugin({
|
||||||
|
@ -14,35 +13,6 @@ installQuasarPlugin({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false });
|
const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false });
|
||||||
const mockPush = vi.fn();
|
|
||||||
const mockReplace = vi.fn();
|
|
||||||
|
|
||||||
vi.mock('vue-router', () => ({
|
|
||||||
useRouter: () => ({
|
|
||||||
push: mockPush,
|
|
||||||
replace: mockReplace,
|
|
||||||
currentRoute: {
|
|
||||||
value: {
|
|
||||||
params: {
|
|
||||||
id: 1,
|
|
||||||
},
|
|
||||||
meta: { moduleName: 'mockName' },
|
|
||||||
matched: [{ path: 'mockName/list' }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
useRoute: () => ({
|
|
||||||
matched: [],
|
|
||||||
query: {},
|
|
||||||
params: {},
|
|
||||||
meta: { moduleName: 'mockName' },
|
|
||||||
path: 'mockSection/list',
|
|
||||||
}),
|
|
||||||
onBeforeRouteLeave: () => {},
|
|
||||||
}));
|
|
||||||
|
|
||||||
vi.mock('axios');
|
|
||||||
|
|
||||||
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
vi.spyOn(useValidator, 'useValidator').mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
validate: vi.fn(),
|
validate: vi.fn(),
|
||||||
|
@ -112,5 +82,4 @@ export function createWrapper(component, options) {
|
||||||
|
|
||||||
return { vm, wrapper };
|
return { vm, wrapper };
|
||||||
}
|
}
|
||||||
|
export { flushPromises };
|
||||||
export { axios, flushPromises };
|
|
||||||
|
|
|
@ -1 +1,27 @@
|
||||||
// This file will be run before each test file, don't delete or vitest will not work.
|
// This file will be run before each test file, don't delete or vitest will not work.
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
|
vi.mock('axios');
|
||||||
|
vi.mock('vue-router', () => ({
|
||||||
|
useRouter: () => ({
|
||||||
|
push: vi.fn(),
|
||||||
|
replace: vi.fn(),
|
||||||
|
currentRoute: {
|
||||||
|
value: {
|
||||||
|
params: {
|
||||||
|
id: 1,
|
||||||
|
},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
matched: [{ path: 'mockName/list' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
useRoute: () => ({
|
||||||
|
matched: [],
|
||||||
|
query: {},
|
||||||
|
params: {},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
path: 'mockSection/list',
|
||||||
|
}),
|
||||||
|
onBeforeRouteLeave: () => {},
|
||||||
|
}));
|
||||||
|
|
Loading…
Reference in New Issue