1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

test: run node_unit_tests with DENO_FUTURE=1 (#25285)

This is blocking https://github.com/denoland/deno/pull/25213.

Turns out a bunch of FS APIs are completely broken because they
use RIDs (resource IDs) instead of FDs (file descriptors).
This commit is contained in:
Bartek Iwańczuk 2024-08-29 01:09:06 +01:00 committed by GitHub
parent 57541b48ba
commit 52fb6582e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 100 additions and 5 deletions

View file

@ -107,6 +107,7 @@ fn node_unit_test(test: String) {
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.env("DENO_FUTURE", "1")
.arg("test")
.arg("--config")
.arg(deno_config_path())

View file

@ -64,6 +64,9 @@ Deno.test({
Deno.test({
name: "Async: Data is written to passed in rid",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = await Deno.makeTempFile();
using file = await Deno.open(tempFile, {
@ -153,6 +156,9 @@ Deno.test({
Deno.test({
name: "Sync: Data is written to passed in rid",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const tempFile: string = Deno.makeTempFileSync();
using file = Deno.openSync(tempFile, {

View file

@ -5,6 +5,9 @@ import { close, closeSync } from "node:fs";
Deno.test({
name: "ASYNC: File is closed",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = await Deno.makeTempFile();
const file: Deno.FsFile = await Deno.open(tempFile);
@ -33,6 +36,9 @@ Deno.test({
Deno.test({
name: "close callback should be asynchronous",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = Deno.makeTempFileSync();
const file: Deno.FsFile = Deno.openSync(tempFile);
@ -53,6 +59,9 @@ Deno.test({
Deno.test({
name: "SYNC: File is closed",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const tempFile: string = Deno.makeTempFileSync();
const file: Deno.FsFile = Deno.openSync(tempFile);
@ -69,7 +78,12 @@ Deno.test({
},
});
Deno.test("[std/node/fs] close callback isn't called twice if error is thrown", async () => {
Deno.test({
name: "[std/node/fs] close callback isn't called twice if error is thrown",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
}, async () => {
const tempFile = await Deno.makeTempFile();
const importUrl = new URL("node:fs", import.meta.url);
await assertCallbackErrorUncaught({

View file

@ -5,6 +5,9 @@ import { fdatasync, fdatasyncSync } from "node:fs";
Deno.test({
name:
"ASYNC: flush any pending data operations of the given file stream to disk",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = await Deno.makeTempFile();
using file = await Deno.open(filePath, {
@ -38,6 +41,9 @@ Deno.test({
Deno.test({
name:
"SYNC: flush any pending data operations of the given file stream to disk.",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
using file = Deno.openSync(filePath, {

View file

@ -7,6 +7,9 @@ import type { BigIntStats, Stats } from "node:fs";
Deno.test({
name: "ASYNC: get a file Stats",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = await Deno.makeTempFile();
using file = await Deno.open(filePath);
@ -31,6 +34,9 @@ Deno.test({
Deno.test({
name: "ASYNC: get a file BigInt Stats",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = await Deno.makeTempFile();
using file = await Deno.open(filePath);
@ -57,6 +63,9 @@ Deno.test({
Deno.test({
name: "SYNC: get a file Stats",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
using file = Deno.openSync(filePath);
@ -71,6 +80,9 @@ Deno.test({
Deno.test({
name: "SYNC: get a file BigInt Stats",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
using file = Deno.openSync(filePath);

View file

@ -4,6 +4,9 @@ import { fsync, fsyncSync } from "node:fs";
Deno.test({
name: "ASYNC: flush any pending data of the given file stream to disk",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = await Deno.makeTempFile();
using file = await Deno.open(filePath, {
@ -36,6 +39,9 @@ Deno.test({
Deno.test({
name: "SYNC: flush any pending data the given file stream to disk",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
using file = Deno.openSync(filePath, {

View file

@ -18,6 +18,9 @@ Deno.test({
Deno.test({
name: "ASYNC: truncate entire file contents",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = Deno.makeTempFileSync();
await Deno.writeTextFile(filePath, "hello world");
@ -50,6 +53,9 @@ Deno.test({
Deno.test({
name: "ASYNC: truncate file to a size of precisely len bytes",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = Deno.makeTempFileSync();
await Deno.writeTextFile(filePath, "hello world");
@ -82,6 +88,9 @@ Deno.test({
Deno.test({
name: "SYNC: truncate entire file contents",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
Deno.writeFileSync(filePath, new TextEncoder().encode("hello world"));
@ -103,6 +112,9 @@ Deno.test({
Deno.test({
name: "SYNC: truncate file to a size of precisely len bytes",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
Deno.writeFileSync(filePath, new TextEncoder().encode("hello world"));

View file

@ -7,6 +7,9 @@ const randomDate = new Date(Date.now() + 1000);
Deno.test({
name:
"ASYNC: change the file system timestamps of the object referenced by path",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const filePath = Deno.makeTempFileSync();
using file = await Deno.open(filePath, { create: true, write: true });
@ -62,6 +65,9 @@ Deno.test({
Deno.test({
name:
"SYNC: change the file system timestamps of the object referenced by path",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const filePath = Deno.makeTempFileSync();
using file = Deno.openSync(filePath, { create: true, write: true });

View file

@ -104,7 +104,12 @@ Deno.test(
);
Deno.test(
"Data is written to correct rid",
{
name: "Data is written to correct rid",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
},
async function testCorrectWriteUsingRid() {
const tempFile: string = await Deno.makeTempFile();
using file = await Deno.open(tempFile, {
@ -191,7 +196,12 @@ Deno.test("Path can be an URL", async function testCorrectWriteUsingURL() {
assertEquals(decoder.decode(data), "hello world");
});
Deno.test("Mode is correctly set", async function testCorrectFileMode() {
Deno.test({
name: "Mode is correctly set",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
}, async function testCorrectFileMode() {
if (Deno.build.os === "windows") return;
const filename = "_fs_writeFile_test_file.txt";
@ -207,7 +217,12 @@ Deno.test("Mode is correctly set", async function testCorrectFileMode() {
});
Deno.test(
"Mode is not set when rid is passed",
{
name: "Mode is not set when rid is passed",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
},
async function testCorrectFileModeRid() {
if (Deno.build.os === "windows") return;
@ -259,7 +274,12 @@ Deno.test(
);
Deno.test(
"Data is written synchronously to correct rid",
{
name: "Data is written synchronously to correct rid",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
},
function testCorrectWriteSyncUsingRid() {
const tempFile: string = Deno.makeTempFileSync();
using file = Deno.openSync(tempFile, {

View file

@ -10,6 +10,9 @@ const decoder = new TextDecoder("utf-8");
Deno.test({
name: "Data is written to the file with the correct length",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = await Deno.makeTempFile();
using file = await Deno.open(tempFile, {
@ -35,6 +38,9 @@ Deno.test({
Deno.test({
name: "Data is written synchronously to the file with the correct length",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
fn() {
const tempFile: string = Deno.makeTempFileSync();
using file = Deno.openSync(tempFile, {
@ -55,6 +61,9 @@ Deno.test({
Deno.test({
name: "Data is padded if position > length",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = Deno.makeTempFileSync();
@ -79,6 +88,9 @@ Deno.test({
Deno.test({
name: "write with offset TypedArray buffers",
// TODO(bartlomieju): this test is broken in Deno 2, because `file.rid` is undefined.
// The fs APIs should be rewritten to use actual FDs, not RIDs
ignore: true,
async fn() {
const tempFile: string = Deno.makeTempFileSync();
using file = Deno.openSync(tempFile, {