-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move testPath from CWD to temporary directory
PR-URL: #46890 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
- Loading branch information
1 parent
669c36b
commit c0faefd
Showing
1 changed file
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,81 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const assert = require('node:assert'); | ||
const fs = require('node:fs'); | ||
const path = require('node:path'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
const testPath = path.join(tmpdir.path, 'assert-encoding-error'); | ||
const options = 'test'; | ||
const expectedError = { | ||
code: 'ERR_INVALID_ARG_VALUE', | ||
name: 'TypeError', | ||
}; | ||
|
||
assert.throws(() => { | ||
fs.readFile('path', options, common.mustNotCall()); | ||
fs.readFile(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.readFileSync('path', options); | ||
fs.readFileSync(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.readdir('path', options, common.mustNotCall()); | ||
fs.readdir(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.readdirSync('path', options); | ||
fs.readdirSync(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.readlink('path', options, common.mustNotCall()); | ||
fs.readlink(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.readlinkSync('path', options); | ||
fs.readlinkSync(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.writeFile('path', 'data', options, common.mustNotCall()); | ||
fs.writeFile(testPath, 'data', options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.writeFileSync('path', 'data', options); | ||
fs.writeFileSync(testPath, 'data', options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.appendFile('path', 'data', options, common.mustNotCall()); | ||
fs.appendFile(testPath, 'data', options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.appendFileSync('path', 'data', options); | ||
fs.appendFileSync(testPath, 'data', options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.watch('path', options, common.mustNotCall()); | ||
fs.watch(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.realpath('path', options, common.mustNotCall()); | ||
fs.realpath(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.realpathSync('path', options); | ||
fs.realpathSync(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.mkdtemp('path', options, common.mustNotCall()); | ||
fs.mkdtemp(testPath, options, common.mustNotCall()); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.mkdtempSync('path', options); | ||
fs.mkdtempSync(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.ReadStream('path', options); | ||
fs.ReadStream(testPath, options); | ||
}, expectedError); | ||
|
||
assert.throws(() => { | ||
fs.WriteStream('path', options); | ||
fs.WriteStream(testPath, options); | ||
}, expectedError); |