mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 13:00:36 -05:00
fix(ext/node): test
This commit is contained in:
parent
a75cd2a9d6
commit
8d195e4d97
4 changed files with 20 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||||
import { FsFile } from "ext:deno_fs/30_fs.js";
|
import { FsFile } from "ext:deno_fs/30_fs.js";
|
||||||
|
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||||
|
|
||||||
export function fdatasync(
|
export function fdatasync(
|
||||||
fd: number,
|
fd: number,
|
||||||
|
@ -19,3 +20,7 @@ export function fdatasync(
|
||||||
export function fdatasyncSync(fd: number) {
|
export function fdatasyncSync(fd: number) {
|
||||||
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncDataSync();
|
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncDataSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fdatasyncPromise = promisify(fdatasync) as (
|
||||||
|
fd: number,
|
||||||
|
) => Promise<void>;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
|
||||||
import { FsFile } from "ext:deno_fs/30_fs.js";
|
import { FsFile } from "ext:deno_fs/30_fs.js";
|
||||||
|
import { promisify } from "ext:deno_node/internal/util.mjs";
|
||||||
|
|
||||||
export function fsync(
|
export function fsync(
|
||||||
fd: number,
|
fd: number,
|
||||||
|
@ -19,3 +20,5 @@ export function fsync(
|
||||||
export function fsyncSync(fd: number) {
|
export function fsyncSync(fd: number) {
|
||||||
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncSync();
|
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fsyncPromise = promisify(fsync) as (fd: number) => Promise<void>;
|
||||||
|
|
|
@ -16,6 +16,8 @@ import {
|
||||||
import { ftruncatePromise } from "ext:deno_node/_fs/_fs_ftruncate.ts";
|
import { ftruncatePromise } from "ext:deno_node/_fs/_fs_ftruncate.ts";
|
||||||
export type { BigIntStats, Stats } from "ext:deno_node/_fs/_fs_stat.ts";
|
export type { BigIntStats, Stats } from "ext:deno_node/_fs/_fs_stat.ts";
|
||||||
import { writevPromise, WriteVResult } from "ext:deno_node/_fs/_fs_writev.ts";
|
import { writevPromise, WriteVResult } from "ext:deno_node/_fs/_fs_writev.ts";
|
||||||
|
import { fdatasyncPromise } from "ext:deno_node/_fs/_fs_fdatasync.ts";
|
||||||
|
import { fsyncPromise } from "ext:deno_node/_fs/_fs_fsync.ts";
|
||||||
|
|
||||||
interface WriteResult {
|
interface WriteResult {
|
||||||
bytesWritten: number;
|
bytesWritten: number;
|
||||||
|
@ -159,11 +161,11 @@ export class FileHandle extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
datasync(): Promise<void> {
|
datasync(): Promise<void> {
|
||||||
return fsCall(promises.fdatasync, this);
|
return fsCall(fdatasyncPromise, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
sync(): Promise<void> {
|
sync(): Promise<void> {
|
||||||
return fsCall(promises.fsync, this);
|
return fsCall(fsyncPromise, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
utimes(
|
utimes(
|
||||||
|
|
8
tests/node_compat/test/fixtures/baz.js
vendored
Normal file
8
tests/node_compat/test/fixtures/baz.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// deno-fmt-ignore-file
|
||||||
|
// deno-lint-ignore-file
|
||||||
|
|
||||||
|
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||||
|
// Taken from Node 20.11.1
|
||||||
|
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||||
|
|
||||||
|
module.exports = 'perhaps I work';
|
Loading…
Add table
Reference in a new issue