| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ const tmpdir = require('../common/tmpdir'); | |||
| 7 | 7 | // The following tests validate aggregate errors are thrown correctly | |
| 8 | 8 | // when both an operation and close throw. | |
| 9 | 9 | ||
| 10 | - const path = require('path'); | ||
| 11 | 10 | const { | |
| 12 | 11 | readFile, | |
| 13 | 12 | writeFile, | |
@@ -23,7 +22,7 @@ const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); | |||
| 23 | 22 | ||
| 24 | 23 | let count = 0; | |
| 25 | 24 | async function createFile() { | |
| 26 | - const filePath = path.join(tmpdir.path, `aggregate_errors_${++count}.txt`); | ||
| 25 | + const filePath = tmpdir.resolve(`aggregate_errors_${++count}.txt`); | ||
| 27 | 26 | await writeFile(filePath, 'content'); | |
| 28 | 27 | return filePath; | |
| 29 | 28 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ const tmpdir = require('../common/tmpdir'); | |||
| 7 | 7 | // The following tests validate aggregate errors are thrown correctly | |
| 8 | 8 | // when both an operation and close throw. | |
| 9 | 9 | ||
| 10 | - const path = require('path'); | ||
| 11 | 10 | const { | |
| 12 | 11 | readFile, | |
| 13 | 12 | writeFile, | |
@@ -23,7 +22,7 @@ const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); | |||
| 23 | 22 | ||
| 24 | 23 | let count = 0; | |
| 25 | 24 | async function createFile() { | |
| 26 | - const filePath = path.join(tmpdir.path, `close_errors_${++count}.txt`); | ||
| 25 | + const filePath = tmpdir.resolve(`close_errors_${++count}.txt`); | ||
| 27 | 26 | await writeFile(filePath, 'content'); | |
| 28 | 27 | return filePath; | |
| 29 | 28 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ const tmpdir = require('../common/tmpdir'); | |||
| 7 | 7 | // The following tests validate aggregate errors are thrown correctly | |
| 8 | 8 | // when both an operation and close throw. | |
| 9 | 9 | ||
| 10 | - const path = require('path'); | ||
| 11 | 10 | const { | |
| 12 | 11 | readFile, | |
| 13 | 12 | writeFile, | |
@@ -23,7 +22,7 @@ const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); | |||
| 23 | 22 | ||
| 24 | 23 | let count = 0; | |
| 25 | 24 | async function createFile() { | |
| 26 | - const filePath = path.join(tmpdir.path, `op_errors_${++count}.txt`); | ||
| 25 | + const filePath = tmpdir.resolve(`op_errors_${++count}.txt`); | ||
| 27 | 26 | await writeFile(filePath, 'content'); | |
| 28 | 27 | return filePath; | |
| 29 | 28 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,9 +2,8 @@ | |||
| 2 | 2 | const common = require('../common'); | |
| 3 | 3 | const fs = require('fs'); | |
| 4 | 4 | const assert = require('assert'); | |
| 5 | - const path = require('path'); | ||
| 6 | 5 | const tmpdir = require('../common/tmpdir'); | |
| 7 | - const file = path.join(tmpdir.path, 'read_stream_filehandle_worker.txt'); | ||
| 6 | + const file = tmpdir.resolve('read_stream_filehandle_worker.txt'); | ||
| 8 | 7 | const input = 'hello world'; | |
| 9 | 8 | const { Worker, isMainThread, workerData } = require('worker_threads'); | |
| 10 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,11 +3,10 @@ import tmpdir from '../common/tmpdir.js'; | |||
| 3 | 3 | ||
| 4 | 4 | import assert from 'node:assert'; | |
| 5 | 5 | import { open, writeFile } from 'node:fs/promises'; | |
| 6 | - import path from 'node:path'; | ||
| 7 | 6 | ||
| 8 | 7 | tmpdir.refresh(); | |
| 9 | 8 | ||
| 10 | - const filePath = path.join(tmpdir.path, 'file.txt'); | ||
| 9 | + const filePath = tmpdir.resolve('file.txt'); | ||
| 11 | 10 | ||
| 12 | 11 | await writeFile(filePath, '1\n\n2\n'); | |
| 13 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,14 +6,13 @@ const common = require('../common'); | |||
| 6 | 6 | // FileHandle.stat method. | |
| 7 | 7 | ||
| 8 | 8 | const { open } = require('fs').promises; | |
| 9 | - const path = require('path'); | ||
| 10 | 9 | const tmpdir = require('../common/tmpdir'); | |
| 11 | 10 | const assert = require('assert'); | |
| 12 | 11 | ||
| 13 | 12 | tmpdir.refresh(); | |
| 14 | 13 | ||
| 15 | 14 | async function validateStat() { | |
| 16 | - const filePath = path.resolve(tmpdir.path, 'tmp-read-file.txt'); | ||
| 15 | + const filePath = tmpdir.resolve('tmp-read-file.txt'); | ||
| 17 | 16 | const fileHandle = await open(filePath, 'w+'); | |
| 18 | 17 | const stats = await fileHandle.stat(); | |
| 19 | 18 | assert.ok(stats.mtime instanceof Date); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,11 +5,10 @@ const fixtures = require('../common/fixtures'); | |||
| 5 | 5 | const tmpdir = require('../common/tmpdir'); | |
| 6 | 6 | ||
| 7 | 7 | const { access, copyFile, open } = require('fs').promises; | |
| 8 | - const path = require('path'); | ||
| 9 | 8 | ||
| 10 | 9 | async function validate() { | |
| 11 | 10 | tmpdir.refresh(); | |
| 12 | - const dest = path.resolve(tmpdir.path, 'baz.js'); | ||
| 11 | + const dest = tmpdir.resolve('baz.js'); | ||
| 13 | 12 | await assert.rejects( | |
| 14 | 13 | copyFile(fixtures.path('baz.js'), dest, 'r'), | |
| 15 | 14 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,15 +2,14 @@ | |||
| 2 | 2 | ||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | const assert = require('assert'); | |
| 5 | - const path = require('path'); | ||
| 6 | 5 | const { open, readFile } = require('fs').promises; | |
| 7 | 6 | const tmpdir = require('../common/tmpdir'); | |
| 8 | 7 | ||
| 9 | 8 | tmpdir.refresh(); | |
| 10 | 9 | ||
| 11 | 10 | async function validateTruncate() { | |
| 12 | 11 | const text = 'Hello world'; | |
| 13 | - const filename = path.resolve(tmpdir.path, 'truncate-file.txt'); | ||
| 12 | + const filename = tmpdir.resolve('truncate-file.txt'); | ||
| 14 | 13 | const fileHandle = await open(filename, 'w+'); | |
| 15 | 14 | ||
| 16 | 15 | const buffer = Buffer.from(text, 'utf8'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,14 +5,13 @@ | |||
| 5 | 5 | ||
| 6 | 6 | const common = require('../common'); | |
| 7 | 7 | const assert = require('assert'); | |
| 8 | - const path = require('path'); | ||
| 9 | 8 | const { writeFileSync } = require('fs'); | |
| 10 | 9 | const { open } = require('fs').promises; | |
| 11 | 10 | ||
| 12 | 11 | const tmpdir = require('../common/tmpdir'); | |
| 13 | 12 | tmpdir.refresh(); | |
| 14 | 13 | ||
| 15 | - const fn = path.join(tmpdir.path, 'test.txt'); | ||
| 14 | + const fn = tmpdir.resolve('test.txt'); | ||
| 16 | 15 | writeFileSync(fn, 'Hello World'); | |
| 17 | 16 | ||
| 18 | 17 | async function readFileTest() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,14 +4,13 @@ | |||
| 4 | 4 | const common = require('../common'); | |
| 5 | 5 | ||
| 6 | 6 | const assert = require('assert'); | |
| 7 | - const path = require('path'); | ||
| 8 | 7 | const { writeFile, readFile } = require('fs').promises; | |
| 9 | 8 | const tmpdir = require('../common/tmpdir'); | |
| 10 | 9 | const { internalBinding } = require('internal/test/binding'); | |
| 11 | 10 | const fsBinding = internalBinding('fs'); | |
| 12 | 11 | tmpdir.refresh(); | |
| 13 | 12 | ||
| 14 | - const fn = path.join(tmpdir.path, 'large-file'); | ||
| 13 | + const fn = tmpdir.resolve('large-file'); | ||
| 15 | 14 | ||
| 16 | 15 | // Creating large buffer with random content | |
| 17 | 16 | const largeBuffer = Buffer.from( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments