From b07f8613c7c66cabf8528ed49afa8abec2f0d182 Mon Sep 17 00:00:00 2001 From: Bailey Herbert Date: Thu, 17 Mar 2022 01:42:37 -0700 Subject: [PATCH] Fix incorrect function name in errors --- src/main.ts | 4 ++-- tests/main.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index df5ea25..76e6548 100644 --- a/src/main.ts +++ b/src/main.ts @@ -294,7 +294,7 @@ function getFlags(options: NormalizedTimeOptions): number { function invokeBindingAsync(path: string, times: NormalizedTimeOptions, flags: number, resolveLinks: boolean, callback: Callback): void { nativeAddon.utimes(getPathBuffer(path), flags, times.btime, times.mtime, times.atime, resolveLinks, (result?: Error) => { if (typeof result !== 'undefined') { - const name = resolveLinks ? 'lutimes' : 'utimes'; + const name = resolveLinks ? 'utimes' : 'lutimes'; const message = result.message.trim().replace(/\.$/, ''); callback(new Error(`${message}, ${name} '${path}'`)); return; @@ -316,7 +316,7 @@ function invokeBindingSync(path: string, times: NormalizedTimeOptions, flags: nu nativeAddon.utimesSync(getPathBuffer(path), flags, times.btime, times.mtime, times.atime, resolveLinks); } catch (error) { - const name = resolveLinks ? 'lutimes' : 'utimes'; + const name = resolveLinks ? 'utimes' : 'lutimes'; const message = (error).message.trim().replace(/\.$/, ''); throw new Error(`${message}, ${name} '${path}'`); } diff --git a/tests/main.test.ts b/tests/main.test.ts index b4519c8..1a77e6d 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -298,7 +298,7 @@ describe('Errors', function() { const filePath = path.join(tempDir, 'nonexistent-file'); await (async () => { - const error = await utils.invoke(filePath, { atime: 447775200000 }, false); + const error = await utils.invoke(filePath, { atime: 447775200000 }, true); expect(typeof error).toBe('string'); if (process.platform === 'win32') { @@ -310,7 +310,7 @@ describe('Errors', function() { })(); await (async () => { - const error = await utils.invokeCallback(filePath, { atime: 447775200000 }); + const error = await utils.invokeCallback(filePath, { atime: 447775200000 }, false); expect(typeof error).toBe('string'); if (process.platform === 'win32') {