diff --git a/src/ApiError.ts b/src/ApiError.ts index 4f2fc7d7e..c5e61ee20 100644 --- a/src/ApiError.ts +++ b/src/ApiError.ts @@ -108,36 +108,36 @@ export class ApiError extends Error implements NodeJS.ErrnoException { return err; } - public static FileError(code: ErrorCode, path: string): ApiError { + public static OnPath(code: ErrorCode, path: string): ApiError { return new ApiError(code, ErrorStrings[code], path); } public static EACCES(path: string): ApiError { - return this.FileError(ErrorCode.EACCES, path); + return this.OnPath(ErrorCode.EACCES, path); } public static ENOENT(path: string): ApiError { - return this.FileError(ErrorCode.ENOENT, path); + return this.OnPath(ErrorCode.ENOENT, path); } public static EEXIST(path: string): ApiError { - return this.FileError(ErrorCode.EEXIST, path); + return this.OnPath(ErrorCode.EEXIST, path); } public static EISDIR(path: string): ApiError { - return this.FileError(ErrorCode.EISDIR, path); + return this.OnPath(ErrorCode.EISDIR, path); } public static ENOTDIR(path: string): ApiError { - return this.FileError(ErrorCode.ENOTDIR, path); + return this.OnPath(ErrorCode.ENOTDIR, path); } public static EPERM(path: string): ApiError { - return this.FileError(ErrorCode.EPERM, path); + return this.OnPath(ErrorCode.EPERM, path); } public static ENOTEMPTY(path: string): ApiError { - return this.FileError(ErrorCode.ENOTEMPTY, path); + return this.OnPath(ErrorCode.ENOTEMPTY, path); } public code: string; diff --git a/test/tests/chmod.test.ts b/test/tests/chmod.test.ts index 83b2dbc42..17b99afd3 100644 --- a/test/tests/chmod.test.ts +++ b/test/tests/chmod.test.ts @@ -7,7 +7,6 @@ const asyncMode = 0o777; const modeSync = 0o644; describe('chmod tests', () => { - it('should change file mode using chmod', async () => { const file1 = path.join(fixturesDir, 'a.js'); diff --git a/test/tests/error-messages.test.ts b/test/tests/error-messages.test.ts index eee3a50ed..6b2d38658 100644 --- a/test/tests/error-messages.test.ts +++ b/test/tests/error-messages.test.ts @@ -1,4 +1,4 @@ -import { backends, fs, configure, fixturesDir } from '../common'; +import { fs, fixturesDir } from '../common'; import * as path from 'path'; import type { ApiError } from '../../src/ApiError'; @@ -31,11 +31,10 @@ const expectSyncError = (fn: (...args) => unknown, p: string, ...args) => { return error; }; -describe.each(backends)('%s Error tests', (name, options) => { - const configured = configure(options); +describe('Error tests', () => { it('should handle async operations with error', async () => { - await configured; + const fn = path.join(fixturesDir, 'non-existent'); await expectError(fs.promises.stat, fn); @@ -61,8 +60,8 @@ describe.each(backends)('%s Error tests', (name, options) => { // Sync operations if (fs.getMount('/').metadata.synchronous) { - it('should handle sync operations with error', async () => { - await configured; + it('should handle sync operations with error', () => { + const fn = path.join(fixturesDir, 'non-existent'); const existingFile = path.join(fixturesDir, 'exit.js'); diff --git a/test/tests/symlink.test.ts b/test/tests/symlink.test.ts index 7515e4572..a6a63a10e 100644 --- a/test/tests/symlink.test.ts +++ b/test/tests/symlink.test.ts @@ -2,7 +2,6 @@ import { backends, fs, fixturesDir } from '../common'; import * as path from 'path'; describe.each(backends)('%s Link and Symlink Test', (name, options) => { - it('should create and read symbolic link', async () => { const linkData = path.join(fixturesDir, '/cycles/root.js'); const linkPath = 'symlink1.js';