|
1 | 1 | 'use strict'; |
2 | | -var common = require('../common'); |
3 | | -var assert = require('assert'); |
4 | | -var fs = require('fs'); |
| 2 | +const common = require('../common'); |
| 3 | +const assert = require('assert'); |
| 4 | +const fs = require('fs'); |
5 | 5 |
|
6 | 6 | function check(async, sync) { |
7 | | - var expected = /Path must be a string without null bytes/; |
8 | | - var argsSync = Array.prototype.slice.call(arguments, 2); |
9 | | - var argsAsync = argsSync.concat(function(er) { |
| 7 | + const expected = /Path must be a string without null bytes/; |
| 8 | + const argsSync = Array.prototype.slice.call(arguments, 2); |
| 9 | + const argsAsync = argsSync.concat((er) => { |
10 | 10 | assert(er && er.message.match(expected)); |
11 | | - assert.equal(er.code, 'ENOENT'); |
| 11 | + assert.strictEqual(er.code, 'ENOENT'); |
12 | 12 | }); |
13 | 13 |
|
14 | 14 | if (sync) |
15 | | - assert.throws(function() { |
16 | | - console.error(sync.name, argsSync); |
| 15 | + assert.throws(() => { |
17 | 16 | sync.apply(null, argsSync); |
18 | 17 | }, expected); |
19 | 18 |
|
@@ -51,7 +50,7 @@ check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar'); |
51 | 50 |
|
52 | 51 | // an 'error' for exists means that it doesn't exist. |
53 | 52 | // one of many reasons why this file is the absolute worst. |
54 | | -fs.exists('foo\u0000bar', function(exists) { |
| 53 | +fs.exists('foo\u0000bar', common.mustCall((exists) => { |
55 | 54 | assert(!exists); |
56 | | -}); |
| 55 | +})); |
57 | 56 | assert(!fs.existsSync('foo\u0000bar')); |
0 commit comments