diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-09 02:32:04 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-16 16:53:47 +0100 |
commit | caee112e52b64f4bc1118c4a5fa5ad7b4211efea (patch) | |
tree | 7b60b49da3f863917a23ebc94c00bf2f13cc1348 /test/parallel/test-fs-options-immutable.js | |
parent | 4d3c3f039af08b954fbbba1e9a50979ffc98592b (diff) | |
download | android-node-v8-caee112e52b64f4bc1118c4a5fa5ad7b4211efea.tar.gz android-node-v8-caee112e52b64f4bc1118c4a5fa5ad7b4211efea.tar.bz2 android-node-v8-caee112e52b64f4bc1118c4a5fa5ad7b4211efea.zip |
test: remove assert.doesNotThrow()
There is actually no reason to use `assert.doesNotThrow()` in the
tests. If a test throws, just let the error bubble up right away
instead of first catching it and then rethrowing it.
PR-URL: https://github.com/nodejs/node/pull/18669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-options-immutable.js')
-rw-r--r-- | test/parallel/test-fs-options-immutable.js | 63 |
1 files changed, 19 insertions, 44 deletions
diff --git a/test/parallel/test-fs-options-immutable.js b/test/parallel/test-fs-options-immutable.js index ca5079b07d..3555c82f19 100644 --- a/test/parallel/test-fs-options-immutable.js +++ b/test/parallel/test-fs-options-immutable.js @@ -17,19 +17,11 @@ const options = Object.freeze({}); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -{ - assert.doesNotThrow(() => - fs.readFile(__filename, options, common.mustCall(errHandler)) - ); - assert.doesNotThrow(() => fs.readFileSync(__filename, options)); -} +fs.readFile(__filename, options, common.mustCall(errHandler)); +fs.readFileSync(__filename, options); -{ - assert.doesNotThrow(() => - fs.readdir(__dirname, options, common.mustCall(errHandler)) - ); - assert.doesNotThrow(() => fs.readdirSync(__dirname, options)); -} +fs.readdir(__dirname, options, common.mustCall(errHandler)); +fs.readdirSync(__dirname, options); if (common.canCreateSymLink()) { const sourceFile = path.resolve(tmpdir.path, 'test-readlink'); @@ -38,63 +30,46 @@ if (common.canCreateSymLink()) { fs.writeFileSync(sourceFile, ''); fs.symlinkSync(sourceFile, linkFile); - assert.doesNotThrow(() => - fs.readlink(linkFile, options, common.mustCall(errHandler)) - ); - assert.doesNotThrow(() => fs.readlinkSync(linkFile, options)); + fs.readlink(linkFile, options, common.mustCall(errHandler)); + fs.readlinkSync(linkFile, options); } { const fileName = path.resolve(tmpdir.path, 'writeFile'); - assert.doesNotThrow(() => fs.writeFileSync(fileName, 'ABCD', options)); - assert.doesNotThrow(() => - fs.writeFile(fileName, 'ABCD', options, common.mustCall(errHandler)) - ); + fs.writeFileSync(fileName, 'ABCD', options); + fs.writeFile(fileName, 'ABCD', options, common.mustCall(errHandler)); } { const fileName = path.resolve(tmpdir.path, 'appendFile'); - assert.doesNotThrow(() => fs.appendFileSync(fileName, 'ABCD', options)); - assert.doesNotThrow(() => - fs.appendFile(fileName, 'ABCD', options, common.mustCall(errHandler)) - ); + fs.appendFileSync(fileName, 'ABCD', options); + fs.appendFile(fileName, 'ABCD', options, common.mustCall(errHandler)); } { - let watch; - assert.doesNotThrow(() => { - watch = fs.watch(__filename, options, common.mustNotCall()); - }); + const watch = fs.watch(__filename, options, common.mustNotCall()); watch.close(); } { - assert.doesNotThrow( - () => fs.watchFile(__filename, options, common.mustNotCall()) - ); + fs.watchFile(__filename, options, common.mustNotCall()); fs.unwatchFile(__filename); } { - assert.doesNotThrow(() => fs.realpathSync(__filename, options)); - assert.doesNotThrow(() => - fs.realpath(__filename, options, common.mustCall(errHandler)) - ); + fs.realpathSync(__filename, options); + fs.realpath(__filename, options, common.mustCall(errHandler)); } { const tempFileName = path.resolve(tmpdir.path, 'mkdtemp-'); - assert.doesNotThrow(() => fs.mkdtempSync(tempFileName, options)); - assert.doesNotThrow(() => - fs.mkdtemp(tempFileName, options, common.mustCall(errHandler)) - ); + fs.mkdtempSync(tempFileName, options); + fs.mkdtemp(tempFileName, options, common.mustCall(errHandler)); } { const fileName = path.resolve(tmpdir.path, 'streams'); - assert.doesNotThrow(() => { - fs.WriteStream(fileName, options).once('open', common.mustCall(() => { - assert.doesNotThrow(() => fs.ReadStream(fileName, options)); - })); - }); + fs.WriteStream(fileName, options).once('open', common.mustCall(() => { + fs.ReadStream(fileName, options); + })); } |