GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: move testPath from CWD to temporary directory · nodejs/node@512f28f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-fs-assert-encoding-error.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-fs-assert-encoding-error.js‎

Copy file name to clipboard
+22-19Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,81 @@
11
'use strict';
22
const common = require('../common');
3-
const assert = require('assert');
4-
const fs = require('fs');
3+
const assert = require('node:assert');
4+
const fs = require('node:fs');
5+
const path = require('node:path');
6+
const tmpdir = require('../common/tmpdir');
57

8+
const testPath = path.join(tmpdir.path, 'assert-encoding-error');
69
const options = 'test';
710
const expectedError = {
811
code: 'ERR_INVALID_ARG_VALUE',
912
name: 'TypeError',
1013
};
1114

1215
assert.throws(() => {
13-
fs.readFile('path', options, common.mustNotCall());
16+
fs.readFile(testPath, options, common.mustNotCall());
1417
}, expectedError);
1518

1619
assert.throws(() => {
17-
fs.readFileSync('path', options);
20+
fs.readFileSync(testPath, options);
1821
}, expectedError);
1922

2023
assert.throws(() => {
21-
fs.readdir('path', options, common.mustNotCall());
24+
fs.readdir(testPath, options, common.mustNotCall());
2225
}, expectedError);
2326

2427
assert.throws(() => {
25-
fs.readdirSync('path', options);
28+
fs.readdirSync(testPath, options);
2629
}, expectedError);
2730

2831
assert.throws(() => {
29-
fs.readlink('path', options, common.mustNotCall());
32+
fs.readlink(testPath, options, common.mustNotCall());
3033
}, expectedError);
3134

3235
assert.throws(() => {
33-
fs.readlinkSync('path', options);
36+
fs.readlinkSync(testPath, options);
3437
}, expectedError);
3538

3639
assert.throws(() => {
37-
fs.writeFile('path', 'data', options, common.mustNotCall());
40+
fs.writeFile(testPath, 'data', options, common.mustNotCall());
3841
}, expectedError);
3942

4043
assert.throws(() => {
41-
fs.writeFileSync('path', 'data', options);
44+
fs.writeFileSync(testPath, 'data', options);
4245
}, expectedError);
4346

4447
assert.throws(() => {
45-
fs.appendFile('path', 'data', options, common.mustNotCall());
48+
fs.appendFile(testPath, 'data', options, common.mustNotCall());
4649
}, expectedError);
4750

4851
assert.throws(() => {
49-
fs.appendFileSync('path', 'data', options);
52+
fs.appendFileSync(testPath, 'data', options);
5053
}, expectedError);
5154

5255
assert.throws(() => {
53-
fs.watch('path', options, common.mustNotCall());
56+
fs.watch(testPath, options, common.mustNotCall());
5457
}, expectedError);
5558

5659
assert.throws(() => {
57-
fs.realpath('path', options, common.mustNotCall());
60+
fs.realpath(testPath, options, common.mustNotCall());
5861
}, expectedError);
5962

6063
assert.throws(() => {
61-
fs.realpathSync('path', options);
64+
fs.realpathSync(testPath, options);
6265
}, expectedError);
6366

6467
assert.throws(() => {
65-
fs.mkdtemp('path', options, common.mustNotCall());
68+
fs.mkdtemp(testPath, options, common.mustNotCall());
6669
}, expectedError);
6770

6871
assert.throws(() => {
69-
fs.mkdtempSync('path', options);
72+
fs.mkdtempSync(testPath, options);
7073
}, expectedError);
7174

7275
assert.throws(() => {
73-
fs.ReadStream('path', options);
76+
fs.ReadStream(testPath, options);
7477
}, expectedError);
7578

7679
assert.throws(() => {
77-
fs.WriteStream('path', options);
80+
fs.WriteStream(testPath, options);
7881
}, expectedError);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.