From 419c398a03f73898eee53064a89a17e64baf8c85 Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 14:06:28 +0530 Subject: [PATCH 01/12] feat: add @stdlib/assert/has-promise-support module to test for native Promise support --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/has-promise-support/lib/index.js | 40 +++++++++++++++++++ .../assert/has-promise-support/lib/main.js | 39 ++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/lib/index.js b/lib/node_modules/@stdlib/assert/has-promise-support/lib/index.js new file mode 100644 index 000000000000..b99fdd0d709e --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test for native Promise support. +* +* @module @stdlib/assert/has-promise-support +* +* @example +* var hasPromiseSupport = require( '@stdlib/assert/has-promise-support' ); +* +* var bool = hasPromiseSupport(); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js new file mode 100644 index 000000000000..1453ef77eb61 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Tests for native Promise support. +* +* @returns {boolean} boolean indicating if an environment has native Promise support +* +* @example +* var bool = hasPromiseSupport(); +* // returns +*/ +function hasPromiseSupport() { + return ( typeof Promise === 'function' ); // eslint-disable-line stdlib/require-globals +} + + +// EXPORTS // + +module.exports = hasPromiseSupport; From aca9f8f2fe0800545893a017c46c77c53fb821c5 Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 14:07:08 +0530 Subject: [PATCH 02/12] feat: add hasPromiseSupport to check for native Promise support --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/assert/lib/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/node_modules/@stdlib/assert/lib/index.js b/lib/node_modules/@stdlib/assert/lib/index.js index 22fa9d8c8b22..3b9ab55aceb2 100644 --- a/lib/node_modules/@stdlib/assert/lib/index.js +++ b/lib/node_modules/@stdlib/assert/lib/index.js @@ -339,6 +339,15 @@ setReadOnly( ns, 'hasNodeBufferSupport', require( '@stdlib/assert/has-node-buffe */ setReadOnly( ns, 'hasOwnProp', require( '@stdlib/assert/has-own-property' ) ); +/** +* @name hasPromiseSupport +* @memberof ns +* @readonly +* @type {Function} +* @see {@link module:@stdlib/assert/has-promise-support} +*/ +setReadOnly( ns, 'hasPromiseSupport', require( '@stdlib/assert/has-promise-support' ) ); + /** * @name hasProp * @memberof ns From cb5b43245c03b905582dc581155c6aac974f42df Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 17:33:28 +0530 Subject: [PATCH 03/12] feat: add test and examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../has-promise-support/examples/index.js | 28 +++ .../has-promise-support/test/test.cli.js | 163 ++++++++++++++++++ .../assert/has-promise-support/test/test.js | 52 ++++++ 3 files changed, 243 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/examples/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/test/test.cli.js create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/test/test.js diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/examples/index.js b/lib/node_modules/@stdlib/assert/has-promise-support/examples/index.js new file mode 100644 index 000000000000..bb1af5bdb3b0 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var hasPromiseSupport = require( './../lib' ); + +var bool = hasPromiseSupport(); +if ( bool ) { + console.log( 'Environment has Promise support.' ); +} else { + console.log( 'Environment lacks Promise support.' ); +} diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.cli.js b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.cli.js new file mode 100644 index 000000000000..25c82a53b8b7 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.cli.js @@ -0,0 +1,163 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var exec = require( 'child_process' ).exec; +var tape = require( 'tape' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); +var EXEC_PATH = require( '@stdlib/process/exec-path' ); +var readFileSync = require( '@stdlib/fs/read-file' ).sync; + + +// VARIABLES // + +var fpath = resolve( __dirname, '..', 'bin', 'cli' ); +var opts = { + 'skip': IS_BROWSER || IS_WINDOWS +}; + + +// FIXTURES // + +var PKG_VERSION = require( './../package.json' ).version; + + +// TESTS // + +tape( 'command-line interface', function test( t ) { + t.ok( true, __filename ); + t.end(); +}); + +tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '--help' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '-h' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '--version' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '-V' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); + } + t.end(); + } +}); + +tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether an environment provides Promise support', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + var str; + if ( error ) { + t.fail( error.message ); + } else { + str = stdout.toString(); + t.strictEqual( str === 'true\n' || str === 'false\n', true, 'prints either `true` or `false` to `stdout`' ); + t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); + } + t.end(); + } +}); diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js new file mode 100644 index 000000000000..a6a3e795bd12 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var detect = require( './../lib' ); + + +// VARIABLES // + +var hasPromise = ( typeof Promise === 'function' ); // eslint-disable-line stdlib/require-globals + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof detect, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'feature detection result is a boolean', function test( t ) { + t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' ); + t.end(); +}); + +tape( 'if Promise is supported, detection result is `true`', function test( t ) { + if ( hasPromise ) { + t.strictEqual( detect(), true, 'detection result is `true`' ); + } else { + t.strictEqual( detect(), false, 'detection result is `false`' ); + } + t.end(); +}); From 1fbe4c886c2fb3b109f2879e6c28a4c2ea230180 Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 17:46:36 +0530 Subject: [PATCH 04/12] feat: add documentation and TypeScript definitions for hasPromiseSupport --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../assert/has-promise-support/docs/repl.txt | 18 ++++++++++ .../has-promise-support/docs/types/index.d.ts | 35 +++++++++++++++++++ .../has-promise-support/docs/types/test.ts | 33 +++++++++++++++++ .../assert/has-promise-support/docs/usage.txt | 8 +++++ 4 files changed, 94 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/docs/usage.txt diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/docs/repl.txt b/lib/node_modules/@stdlib/assert/has-promise-support/docs/repl.txt new file mode 100644 index 000000000000..3d33916e304d --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/docs/repl.txt @@ -0,0 +1,18 @@ + +{{alias}}() + Tests for native Promise support. + + Returns + ------- + bool: boolean + Boolean indicating if an environment has native Promise support. + + Examples + -------- + > var bool = {{alias}}() + + + See Also + -------- + + diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/index.d.ts new file mode 100644 index 000000000000..dae210bf93f5 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests for native Promise support. +* +* @returns boolean indicating if an environment has native Promise support +* +* @example +* var bool = hasPromiseSupport(); +* // returns +*/ +declare function hasPromiseSupport(): boolean; + + +// EXPORTS // + +export = hasPromiseSupport; diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/test.ts b/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/test.ts new file mode 100644 index 000000000000..3d097b40e0f2 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/docs/types/test.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hasPromiseSupport = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + hasPromiseSupport(); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided arguments... +{ + hasPromiseSupport( true ); // $ExpectError + hasPromiseSupport( [], 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/docs/usage.txt b/lib/node_modules/@stdlib/assert/has-promise-support/docs/usage.txt new file mode 100644 index 000000000000..613f0cbad15c --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/docs/usage.txt @@ -0,0 +1,8 @@ + +Usage: has-promise-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. + From 66277e3c1c108aeffb1a71e501b0705019c174c4 Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 17:47:25 +0530 Subject: [PATCH 05/12] feat: implement hasPromiseSupport module to detect native Promise support --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: passed - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/assert/docs/types/index.d.ts | 12 ++ .../assert/has-promise-support/README.md | 123 ++++++++++++++++++ .../benchmark/benchmark.js | 49 +++++++ .../assert/has-promise-support/bin/cli | 60 +++++++++ .../has-promise-support/etc/cli_opts.json | 14 ++ .../assert/has-promise-support/package.json | 74 +++++++++++ 6 files changed, 332 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/README.md create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/benchmark/benchmark.js create mode 100755 lib/node_modules/@stdlib/assert/has-promise-support/bin/cli create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/etc/cli_opts.json create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/package.json diff --git a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts index a2dd2d4d8a0b..6648582dcdc3 100644 --- a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts @@ -53,6 +53,7 @@ import hasMapSupport = require( '@stdlib/assert/has-map-support' ); import hasMatchSymbolSupport = require( '@stdlib/assert/has-match-symbol-support' ); import hasNodeBufferSupport = require( '@stdlib/assert/has-node-buffer-support' ); import hasOwnProp = require( '@stdlib/assert/has-own-property' ); +import hasPromiseSupport = require( '@stdlib/assert/has-promise-support' ); import hasProp = require( '@stdlib/assert/has-property' ); import hasProxySupport = require( '@stdlib/assert/has-proxy-support' ); import hasReplaceSymbolSupport = require( '@stdlib/assert/has-replace-symbol-support' ); @@ -892,6 +893,17 @@ interface Namespace { */ hasOwnProp: typeof hasOwnProp; + /** + * Tests for native Promise support. + * + * @returns boolean indicating if an environment has native Promise support + * + * @example + * var bool = ns.hasPromiseSupport(); + * // returns + */ + hasPromiseSupport: typeof hasPromiseSupport; + /** * Tests if an object has a specified property, either own or inherited. * diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/README.md b/lib/node_modules/@stdlib/assert/has-promise-support/README.md new file mode 100644 index 000000000000..5600b6252429 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/README.md @@ -0,0 +1,123 @@ + + +# Promise Support + +> Detect native [`Promise`][mdn-promise] support. + +
+ +## Usage + +```javascript +var hasPromiseSupport = require( '@stdlib/assert/has-promise-support' ); +``` + +#### hasPromiseSupport() + +Detects if a runtime environment supports ES2015 [`Promise`][mdn-promise]. + +```javascript +var bool = hasPromiseSupport(); +// returns +``` + +
+ + + +
+ +## Examples + + + +```javascript +var hasPromiseSupport = require( '@stdlib/assert/has-promise-support' ); + +var bool = hasPromiseSupport(); +if ( bool ) { + console.log( 'Environment has Promise support.' ); +} else { + console.log( 'Environment lacks Promise support.' ); +} +``` + +
+ + + +* * * + +
+ +## CLI + +
+ +### Usage + +```text +Usage: has-promise-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. +``` + +
+ + + +
+ +### Examples + +```bash +$ has-promise-support + +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/has-promise-support/benchmark/benchmark.js new file mode 100644 index 000000000000..03f976a56cc1 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/benchmark/benchmark.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var hasPromiseSupport = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var bool; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + // Note: the following *could* be optimized away via loop-invariant code motion. If so, the entire loop will disappear. + bool = hasPromiseSupport(); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/bin/cli b/lib/node_modules/@stdlib/assert/has-promise-support/bin/cli new file mode 100755 index 000000000000..f7fb81913da6 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/bin/cli @@ -0,0 +1,60 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var readFileSync = require( '@stdlib/fs/read-file' ).sync; +var CLI = require( '@stdlib/cli/ctor' ); +var detect = require( './../lib' ); + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var flags; + var cli; + + // Create a command-line interface: + cli = new CLI({ + 'pkg': require( './../package.json' ), + 'options': require( './../etc/cli_opts.json' ), + 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }) + }); + + // Get any provided command-line options: + flags = cli.flags(); + if ( flags.help || flags.version ) { + return; + } + + console.log( detect() ); // eslint-disable-line no-console +} + +main(); diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/etc/cli_opts.json b/lib/node_modules/@stdlib/assert/has-promise-support/etc/cli_opts.json new file mode 100644 index 000000000000..f245a17e6317 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/etc/cli_opts.json @@ -0,0 +1,14 @@ +{ + "boolean": [ + "help", + "version" + ], + "alias": { + "help": [ + "h" + ], + "version": [ + "V" + ] + } +} diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/package.json b/lib/node_modules/@stdlib/assert/has-promise-support/package.json new file mode 100644 index 000000000000..611465118e93 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/assert/has-promise-support", + "version": "0.0.0", + "description": "Detect native Promise support.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "bin": { + "has-promise-support": "./bin/cli" + }, + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdutils", + "stdutil", + "utilities", + "utility", + "utils", + "util", + "detect", + "feature", + "promise", + "promises", + "es2015", + "es6", + "support", + "has", + "native", + "issupported", + "cli" + ] +} From c1574abfe14fd4ada8b05a509090724293df8f6c Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Thu, 6 Aug 2026 17:48:12 +0530 Subject: [PATCH 06/12] feat: add has-promise-support into docs --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/assert/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/assert/README.md b/lib/node_modules/@stdlib/assert/README.md index cb6c77b20aef..3ae5cebfe909 100644 --- a/lib/node_modules/@stdlib/assert/README.md +++ b/lib/node_modules/@stdlib/assert/README.md @@ -372,6 +372,7 @@ To test whether a runtime environment supports certain features, the namespace i - [`hasMapSupport()`][@stdlib/assert/has-map-support]: detect native `Map` support. - [`hasMatchSymbolSupport()`][@stdlib/assert/has-match-symbol-support]: detect native `Symbol.match` support. - [`hasNodeBufferSupport()`][@stdlib/assert/has-node-buffer-support]: detect native `Buffer` support. +- [`hasPromiseSupport()`][@stdlib/assert/has-promise-support]: detect native `Promise` support. - [`hasProxySupport()`][@stdlib/assert/has-proxy-support]: detect native `Proxy` support. - [`hasReplaceSymbolSupport()`][@stdlib/assert/has-replace-symbol-support]: detect native `Symbol.replace` support. - [`hasSearchSymbolSupport()`][@stdlib/assert/has-search-symbol-support]: detect native `Symbol.search` support. @@ -903,6 +904,8 @@ console.log( objectKeys( assert ) ); [@stdlib/assert/has-node-buffer-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-node-buffer-support +[@stdlib/assert/has-promise-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-promise-support + [@stdlib/assert/has-proxy-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-proxy-support [@stdlib/assert/has-replace-symbol-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-replace-symbol-support From 4a5cd6cf3b5af04246ad751399905c3d455af008 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 6 Aug 2026 16:25:18 -0700 Subject: [PATCH 07/12] Discard changes to lib/node_modules/@stdlib/assert/docs/types/index.d.ts --- .../@stdlib/assert/docs/types/index.d.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts index 6648582dcdc3..a2dd2d4d8a0b 100644 --- a/lib/node_modules/@stdlib/assert/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/assert/docs/types/index.d.ts @@ -53,7 +53,6 @@ import hasMapSupport = require( '@stdlib/assert/has-map-support' ); import hasMatchSymbolSupport = require( '@stdlib/assert/has-match-symbol-support' ); import hasNodeBufferSupport = require( '@stdlib/assert/has-node-buffer-support' ); import hasOwnProp = require( '@stdlib/assert/has-own-property' ); -import hasPromiseSupport = require( '@stdlib/assert/has-promise-support' ); import hasProp = require( '@stdlib/assert/has-property' ); import hasProxySupport = require( '@stdlib/assert/has-proxy-support' ); import hasReplaceSymbolSupport = require( '@stdlib/assert/has-replace-symbol-support' ); @@ -893,17 +892,6 @@ interface Namespace { */ hasOwnProp: typeof hasOwnProp; - /** - * Tests for native Promise support. - * - * @returns boolean indicating if an environment has native Promise support - * - * @example - * var bool = ns.hasPromiseSupport(); - * // returns - */ - hasPromiseSupport: typeof hasPromiseSupport; - /** * Tests if an object has a specified property, either own or inherited. * From 7a2630f62b582603766062a3b950d3cd5a0e3f0e Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 6 Aug 2026 16:25:48 -0700 Subject: [PATCH 08/12] Discard changes to lib/node_modules/@stdlib/assert/lib/index.js --- lib/node_modules/@stdlib/assert/lib/index.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/lib/index.js b/lib/node_modules/@stdlib/assert/lib/index.js index 3b9ab55aceb2..22fa9d8c8b22 100644 --- a/lib/node_modules/@stdlib/assert/lib/index.js +++ b/lib/node_modules/@stdlib/assert/lib/index.js @@ -339,15 +339,6 @@ setReadOnly( ns, 'hasNodeBufferSupport', require( '@stdlib/assert/has-node-buffe */ setReadOnly( ns, 'hasOwnProp', require( '@stdlib/assert/has-own-property' ) ); -/** -* @name hasPromiseSupport -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/assert/has-promise-support} -*/ -setReadOnly( ns, 'hasPromiseSupport', require( '@stdlib/assert/has-promise-support' ) ); - /** * @name hasProp * @memberof ns From 06f2556de3ce31bc6996d30983f4546c4635cce7 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 6 Aug 2026 16:25:56 -0700 Subject: [PATCH 09/12] Discard changes to lib/node_modules/@stdlib/assert/README.md --- lib/node_modules/@stdlib/assert/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/README.md b/lib/node_modules/@stdlib/assert/README.md index 3ae5cebfe909..cb6c77b20aef 100644 --- a/lib/node_modules/@stdlib/assert/README.md +++ b/lib/node_modules/@stdlib/assert/README.md @@ -372,7 +372,6 @@ To test whether a runtime environment supports certain features, the namespace i - [`hasMapSupport()`][@stdlib/assert/has-map-support]: detect native `Map` support. - [`hasMatchSymbolSupport()`][@stdlib/assert/has-match-symbol-support]: detect native `Symbol.match` support. - [`hasNodeBufferSupport()`][@stdlib/assert/has-node-buffer-support]: detect native `Buffer` support. -- [`hasPromiseSupport()`][@stdlib/assert/has-promise-support]: detect native `Promise` support. - [`hasProxySupport()`][@stdlib/assert/has-proxy-support]: detect native `Proxy` support. - [`hasReplaceSymbolSupport()`][@stdlib/assert/has-replace-symbol-support]: detect native `Symbol.replace` support. - [`hasSearchSymbolSupport()`][@stdlib/assert/has-search-symbol-support]: detect native `Symbol.search` support. @@ -904,8 +903,6 @@ console.log( objectKeys( assert ) ); [@stdlib/assert/has-node-buffer-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-node-buffer-support -[@stdlib/assert/has-promise-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-promise-support - [@stdlib/assert/has-proxy-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-proxy-support [@stdlib/assert/has-replace-symbol-support]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/assert/has-replace-symbol-support From d2f82de7cf6e3117cf6d0471789b7cf9798d16fe Mon Sep 17 00:00:00 2001 From: 0PrashantYadav0 Date: Fri, 7 Aug 2026 14:29:21 +0530 Subject: [PATCH 10/12] feat: enhance promise support detection --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../assert/has-promise-support/lib/main.js | 11 ++- .../assert/has-promise-support/lib/promise.js | 28 +++++++ .../assert/has-promise-support/test/test.js | 83 ++++++++++++++++++- 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/assert/has-promise-support/lib/promise.js diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js index 1453ef77eb61..76244e7fbaaa 100644 --- a/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js +++ b/lib/node_modules/@stdlib/assert/has-promise-support/lib/main.js @@ -18,6 +18,11 @@ 'use strict'; +// MODULES // + +var GlobalPromise = require( './promise.js' ); + + // MAIN // /** @@ -30,7 +35,11 @@ * // returns */ function hasPromiseSupport() { - return ( typeof Promise === 'function' ); // eslint-disable-line stdlib/require-globals + return ( + typeof GlobalPromise === 'function' && + typeof GlobalPromise.resolve === 'function' && + typeof GlobalPromise.reject === 'function' + ); } diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/lib/promise.js b/lib/node_modules/@stdlib/assert/has-promise-support/lib/promise.js new file mode 100644 index 000000000000..7b3070c04403 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-promise-support/lib/promise.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +var main = ( typeof Promise === 'function' ) ? Promise : null; // eslint-disable-line stdlib/require-globals + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js index a6a3e795bd12..6831c5f7fdd7 100644 --- a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js @@ -21,6 +21,7 @@ // MODULES // var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); var detect = require( './../lib' ); @@ -42,11 +43,91 @@ tape( 'feature detection result is a boolean', function test( t ) { t.end(); }); -tape( 'if Promise is supported, detection result is `true`', function test( t ) { +tape( 'if `Promise` is supported, detection result is `true`', function test( t ) { + var mocked; + var Mock; + if ( hasPromise ) { t.strictEqual( detect(), true, 'detection result is `true`' ); } else { t.strictEqual( detect(), false, 'detection result is `false`' ); } + + Mock = createMock({ + 'resolve': true, + 'reject': true + }); + mocked = proxyquire( './../lib/main.js', { + './promise.js': Mock + }); + t.strictEqual( mocked(), true, 'detection result is `true` (mocked)' ); t.end(); }); + +tape( 'if `Promise` is not supported, detection result is `false`', function test( t ) { + var mocked; + var Mock; + + if ( hasPromise ) { + t.strictEqual( detect(), true, 'detection result is `true`' ); + } else { + t.strictEqual( detect(), false, 'detection result is `false`' ); + } + mocked = proxyquire( './../lib/main.js', { + './promise.js': {} + }); + t.strictEqual( mocked(), false, 'detection result is `false` (mocked)' ); + + Mock = createMock({ + 'reject': true + }); + mocked = proxyquire( './../lib/main.js', { + './promise.js': Mock + }); + t.strictEqual( mocked(), false, 'detection result is `false` (no `resolve` method)' ); + + Mock = createMock({ + 'resolve': true + }); + mocked = proxyquire( './../lib/main.js', { + './promise.js': Mock + }); + t.strictEqual( mocked(), false, 'detection result is `false` (no `reject` method)' ); + + t.end(); +}); + + +// FUNCTIONS // + +/** +* Returns a mock Promise constructor. +* +* @private +* @param {Object} methods - methods to attach +* @param {boolean} [methods.resolve] - boolean indicating whether to attach a `resolve` method +* @param {boolean} [methods.reject] - boolean indicating whether to attach a `reject` method +* @returns {Function} mock constructor +*/ +function createMock( methods ) { + function Mock() { + // No-op... + } + if ( methods.resolve ) { + Mock.resolve = noop; + } + if ( methods.reject ) { + Mock.reject = noop; + } + Mock[ '@noCallThru' ] = true; + return Mock; + + /** + * No-op function. + * + * @private + */ + function noop() { + // No-op... + } +} From 11a84392db459dd585d6217a407a5cd043a8db1b Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 7 Aug 2026 02:43:27 -0700 Subject: [PATCH 11/12] test: move function to top of scope Signed-off-by: Athan --- .../assert/has-promise-support/test/test.js | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js index 6831c5f7fdd7..25c37f411bd9 100644 --- a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js @@ -30,6 +30,41 @@ var detect = require( './../lib' ); var hasPromise = ( typeof Promise === 'function' ); // eslint-disable-line stdlib/require-globals +// FUNCTIONS // + +/** +* Returns a mock Promise constructor. +* +* @private +* @param {Object} methods - methods to attach +* @param {boolean} [methods.resolve] - boolean indicating whether to attach a `resolve` method +* @param {boolean} [methods.reject] - boolean indicating whether to attach a `reject` method +* @returns {Function} mock constructor +*/ +function createMock( methods ) { + function Mock() { + // No-op... + } + if ( methods.resolve ) { + Mock.resolve = noop; + } + if ( methods.reject ) { + Mock.reject = noop; + } + Mock[ '@noCallThru' ] = true; + return Mock; + + /** + * No-op function. + * + * @private + */ + function noop() { + // No-op... + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -96,38 +131,3 @@ tape( 'if `Promise` is not supported, detection result is `false`', function tes t.end(); }); - - -// FUNCTIONS // - -/** -* Returns a mock Promise constructor. -* -* @private -* @param {Object} methods - methods to attach -* @param {boolean} [methods.resolve] - boolean indicating whether to attach a `resolve` method -* @param {boolean} [methods.reject] - boolean indicating whether to attach a `reject` method -* @returns {Function} mock constructor -*/ -function createMock( methods ) { - function Mock() { - // No-op... - } - if ( methods.resolve ) { - Mock.resolve = noop; - } - if ( methods.reject ) { - Mock.reject = noop; - } - Mock[ '@noCallThru' ] = true; - return Mock; - - /** - * No-op function. - * - * @private - */ - function noop() { - // No-op... - } -} From 5994afafb274cd5c38e5173c5ca71c708f99c2de Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 7 Aug 2026 02:45:24 -0700 Subject: [PATCH 12/12] test: update assertion messages Signed-off-by: Athan --- .../assert/has-promise-support/test/test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js index 25c37f411bd9..baf416e0b939 100644 --- a/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-promise-support/test/test.js @@ -74,7 +74,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'feature detection result is a boolean', function test( t ) { - t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' ); + t.strictEqual( typeof detect(), 'boolean', 'returns expected value' ); t.end(); }); @@ -83,9 +83,9 @@ tape( 'if `Promise` is supported, detection result is `true`', function test( t var Mock; if ( hasPromise ) { - t.strictEqual( detect(), true, 'detection result is `true`' ); + t.strictEqual( detect(), true, 'returns expected value' ); } else { - t.strictEqual( detect(), false, 'detection result is `false`' ); + t.strictEqual( detect(), false, 'returns expected value' ); } Mock = createMock({ @@ -95,7 +95,7 @@ tape( 'if `Promise` is supported, detection result is `true`', function test( t mocked = proxyquire( './../lib/main.js', { './promise.js': Mock }); - t.strictEqual( mocked(), true, 'detection result is `true` (mocked)' ); + t.strictEqual( mocked(), true, 'returns expected value' ); t.end(); }); @@ -104,14 +104,14 @@ tape( 'if `Promise` is not supported, detection result is `false`', function tes var Mock; if ( hasPromise ) { - t.strictEqual( detect(), true, 'detection result is `true`' ); + t.strictEqual( detect(), true, 'returns expected value' ); } else { - t.strictEqual( detect(), false, 'detection result is `false`' ); + t.strictEqual( detect(), false, 'returns expected value' ); } mocked = proxyquire( './../lib/main.js', { './promise.js': {} }); - t.strictEqual( mocked(), false, 'detection result is `false` (mocked)' ); + t.strictEqual( mocked(), false, 'returns expected value' ); Mock = createMock({ 'reject': true @@ -119,7 +119,7 @@ tape( 'if `Promise` is not supported, detection result is `false`', function tes mocked = proxyquire( './../lib/main.js', { './promise.js': Mock }); - t.strictEqual( mocked(), false, 'detection result is `false` (no `resolve` method)' ); + t.strictEqual( mocked(), false, 'returns expected value' ); Mock = createMock({ 'resolve': true @@ -127,7 +127,7 @@ tape( 'if `Promise` is not supported, detection result is `false`', function tes mocked = proxyquire( './../lib/main.js', { './promise.js': Mock }); - t.strictEqual( mocked(), false, 'detection result is `false` (no `reject` method)' ); + t.strictEqual( mocked(), false, 'returns expected value' ); t.end(); });