1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-27 04:44:38 +02:00
Files
syuilo b51d5ba0a0 frontend bundle diagnostics と frontend browser diagnostics を統合 (#17757)
* refactor(gh): unify frontend diagnostics

* refactor(gh): unify frontend diagnostics markdown rendering

* docs(gh): restore frontend diagnostics comments

* wip

* fix

* refactor: 呼称をbase/headに統一

* tweak

* Update types.ts

* fix
2026-07-21 11:26:53 +09:00

30 lines
839 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { promises as fs } from 'node:fs';
import { afterEach, expect, test, vi } from 'vitest';
import { fileExists } from '../../src/bundle/fs-utils';
function fsError(code: string) {
return Object.assign(new Error(`fs error: ${code}`), { code }) as NodeJS.ErrnoException;
}
afterEach(() => {
vi.restoreAllMocks();
});
test('fileExists returns false for ENOENT', async () => {
vi.spyOn(fs, 'access').mockRejectedValueOnce(fsError('ENOENT'));
await expect(fileExists('missing')).resolves.toBe(false);
});
test('fileExists rethrows errors other than ENOENT', async () => {
const error = fsError('EACCES');
vi.spyOn(fs, 'access').mockRejectedValueOnce(error);
await expect(fileExists('restricted')).rejects.toBe(error);
});