ui_migration config(vitest) reduce heap size for unitest
This commit is contained in:
parent
591d3f6747
commit
e803d60013
3 changed files with 42 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { shallowMount, flushPromises } from "@vue/test-utils";
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { createTestingPinia } from "@pinia/testing";
|
||||
import { setActivePinia } from 'pinia';
|
||||
import axios from "axios";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
|
@ -37,8 +38,9 @@ describe("Test LoggingContent.vue", () => {
|
|||
|
||||
// Things to do before each test
|
||||
beforeEach(async () => {
|
||||
vi.useFakeTimers()
|
||||
// Reset mocks before each test
|
||||
vi.clearAllMocks();
|
||||
vi.resetAllMocks();
|
||||
|
||||
// Set axios to return our fake logs
|
||||
axios.get.mockResolvedValue({ data: mockLogData });
|
||||
|
|
@ -67,11 +69,23 @@ describe("Test LoggingContent.vue", () => {
|
|||
});
|
||||
// flush so we avoid leaving uncompleted processes running on background
|
||||
await flushPromises();
|
||||
vi.advanceTimersByTime(1000)
|
||||
vi.useRealTimers()
|
||||
});
|
||||
|
||||
// Tear down wrapper, unmount testing component
|
||||
afterEach(() => {
|
||||
wrapper.unmount();
|
||||
if (wrapper) {
|
||||
wrapper.unmount() // Clean up virtual DOM and memory bindings
|
||||
}
|
||||
setActivePinia(undefined)
|
||||
document.body.innerHTML = ''
|
||||
|
||||
if (global.gc) {
|
||||
global.gc() // Forces V8 engine to immediately run Garbage Collection
|
||||
}
|
||||
vi.clearAllTimers()
|
||||
vi.useRealTimers()
|
||||
});
|
||||
|
||||
// Test 1: Render check, if things do exist in the page as intended
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue