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') {