| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 60dc362 commit 4a9511d
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -278,9 +278,9 @@ function exists(path, callback) { | |||
| 278 | 278 | ||
| 279 | 279 | ObjectDefineProperty(exists, internalUtil.promisify.custom, { | |
| 280 | 280 | __proto__: null, | |
| 281 | - value: (path) => { | ||
| 281 | + value: function exists(path) { // eslint-disable-line func-name-matching | ||
| 282 | 282 | return new Promise((resolve) => fs.exists(path, resolve)); | |
| 283 | - } | ||
| 283 | + }, | ||
| 284 | 284 | }); | |
| 285 | 285 | ||
| 286 | 286 | // fs.existsSync never throws, it only returns true or false. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,7 +153,7 @@ Interface.prototype.question = function(query, options, cb) { | |||
| 153 | 153 | FunctionPrototypeCall(superQuestion, this, query, cb); | |
| 154 | 154 | } | |
| 155 | 155 | }; | |
| 156 | - Interface.prototype.question[promisify.custom] = function(query, options) { | ||
| 156 | + Interface.prototype.question[promisify.custom] = function question(query, options) { | ||
| 157 | 157 | options = typeof options === 'object' && options !== null ? options : {}; | |
| 158 | 158 | ||
| 159 | 159 | if (options.signal && options.signal.aborted) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,40 @@ | |||
| 1 | + import '../common/index.mjs'; | ||
| 2 | + import assert from 'node:assert'; | ||
| 3 | + import { promisify } from 'node:util'; | ||
| 4 | + | ||
| 5 | + // Test that customly promisified methods in [util.promisify.custom] | ||
| 6 | + // have appropriate names | ||
| 7 | + | ||
| 8 | + import fs from 'node:fs'; | ||
| 9 | + import readline from 'node:readline'; | ||
| 10 | + import stream from 'node:stream'; | ||
| 11 | + import timers from 'node:timers'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + assert.strictEqual( | ||
| 15 | + promisify(fs.exists).name, | ||
| 16 | + 'exists' | ||
| 17 | + ); | ||
| 18 | + | ||
| 19 | + assert.strictEqual( | ||
| 20 | + promisify(readline.Interface.prototype.question).name, | ||
| 21 | + 'question', | ||
| 22 | + ); | ||
| 23 | + | ||
| 24 | + assert.strictEqual( | ||
| 25 | + promisify(stream.finished).name, | ||
| 26 | + 'finished' | ||
| 27 | + ); | ||
| 28 | + assert.strictEqual( | ||
| 29 | + promisify(stream.pipeline).name, | ||
| 30 | + 'pipeline' | ||
| 31 | + ); | ||
| 32 | + | ||
| 33 | + assert.strictEqual( | ||
| 34 | + promisify(timers.setImmediate).name, | ||
| 35 | + 'setImmediate' | ||
| 36 | + ); | ||
| 37 | + assert.strictEqual( | ||
| 38 | + promisify(timers.setTimeout).name, | ||
| 39 | + 'setTimeout' | ||
| 40 | + ); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments