mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
chore(web): migrate to vitest (#5754)
* Updated vite and ts config file with vtest options and a new alias to fix the dev command error * Updated package script and update the packages -- this removes jest dependencies * Added new setup file needed in vitest in order to be able to use the jest-dom matchers in tests * Updated deprecated utilities when using faker * Updated test files and mocks to use vitest instead of jest * Enabled web test check in GitHub actions * remove babel dependencies as they are no longer needed with vitest * move the jest config files to a folder in case we need to go back to jest * chore: remove old files --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
parent
9de557916b
commit
5f6d09d3da
18 changed files with 2227 additions and 6080 deletions
|
|
@ -12,20 +12,18 @@ describe('Executor Queue test', function () {
|
|||
});
|
||||
|
||||
it('should respect concurrency parameter', function () {
|
||||
jest.useFakeTimers();
|
||||
vi.useFakeTimers();
|
||||
const eq = new ExecutorQueue({ concurrency: 3 });
|
||||
|
||||
const finished = jest.fn();
|
||||
const started = jest.fn();
|
||||
const finished = vi.fn();
|
||||
const started = vi.fn();
|
||||
|
||||
const timeoutPromiseBuilder = (delay: number, id: string) =>
|
||||
new Promise((resolve) => {
|
||||
console.log('Task is running: ', id);
|
||||
started();
|
||||
setTimeout(() => {
|
||||
console.log('Finished ' + id + ' after', delay, 'ms');
|
||||
finished();
|
||||
resolve(undefined);
|
||||
resolve(id);
|
||||
}, delay);
|
||||
});
|
||||
|
||||
|
|
@ -39,16 +37,16 @@ describe('Executor Queue test', function () {
|
|||
expect(finished).not.toBeCalled();
|
||||
expect(started).toHaveBeenCalledTimes(3);
|
||||
|
||||
jest.advanceTimersByTime(100);
|
||||
vi.advanceTimersByTime(100);
|
||||
expect(finished).toHaveBeenCalledTimes(1);
|
||||
|
||||
jest.advanceTimersByTime(250);
|
||||
vi.advanceTimersByTime(250);
|
||||
expect(finished).toHaveBeenCalledTimes(3);
|
||||
// expect(started).toHaveBeenCalledTimes(4)
|
||||
|
||||
//TODO : fix The test ...
|
||||
|
||||
jest.runAllTimers();
|
||||
jest.useRealTimers();
|
||||
vi.runAllTimers();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue