mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
chore(deps): update vitest (#67056)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -73,21 +73,24 @@ describe('replace-imports', () => {
|
||||
|
||||
it('should fail when the imported file cannot be found', async () => {
|
||||
expect.assertions(2);
|
||||
console.error = vi.fn();
|
||||
const consoleErrorSpy = vi
|
||||
.spyOn(console, 'error')
|
||||
.mockImplementation(() => {});
|
||||
const plugin = addImports();
|
||||
|
||||
await expect(
|
||||
new Promise((resolve, reject) => {
|
||||
plugin(importsAST, incorrectFile, err => {
|
||||
if (err) {
|
||||
expect(console.error).toHaveBeenCalledTimes(2);
|
||||
resolve();
|
||||
reject(err);
|
||||
} else {
|
||||
reject('An error should have been thrown by addImports');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
})
|
||||
).resolves.toBeUndefined();
|
||||
).rejects.toBeTruthy();
|
||||
expect(consoleErrorSpy).toHaveBeenCalledTimes(2);
|
||||
consoleErrorSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should modify the tree when there are imports', async () => {
|
||||
@@ -219,22 +222,25 @@ describe('replace-imports', () => {
|
||||
});
|
||||
|
||||
it('should reject imported files with editable region markers', async () => {
|
||||
expect.assertions(2); // One inside the callback and one for the outer expect
|
||||
console.error = vi.fn();
|
||||
expect.assertions(2);
|
||||
const consoleErrorSpy = vi
|
||||
.spyOn(console, 'error')
|
||||
.mockImplementation(() => {});
|
||||
const plugin = addImports();
|
||||
|
||||
await expect(
|
||||
new Promise((resolve, reject) => {
|
||||
plugin(markerAST, correctFile, err => {
|
||||
if (err) {
|
||||
expect(console.error).toHaveBeenCalledTimes(2);
|
||||
reject(err);
|
||||
} else {
|
||||
reject('An error should have been thrown by addImports');
|
||||
resolve();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
).resolves.toBeUndefined();
|
||||
).rejects.toBeTruthy();
|
||||
expect(consoleErrorSpy).toHaveBeenCalledTimes(2);
|
||||
consoleErrorSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should have an output to match the snapshot', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
|
||||
import { ENGLISH_CHALLENGE_NO_FILES } from './__fixtures__/challenge-objects';
|
||||
import { SIMPLE_TRANSLATION } from './__mocks__/mock-comments';
|
||||
import { SIMPLE_TRANSLATION } from './__fixtures__/mock-comments';
|
||||
import {
|
||||
translateComments,
|
||||
translateCommentsInChallenge,
|
||||
|
||||
Reference in New Issue
Block a user