summaryrefslogtreecommitdiff
path: root/test/node-api/test_threadsafe_function/test.js
diff options
context:
space:
mode:
authorlegendecas <legendecas@gmail.com>2019-05-21 13:48:35 +0800
committerRich Trott <rtrott@gmail.com>2019-06-21 20:23:22 -0600
commit5705d7bf6089bb8f8a8887658f7c60de6779491c (patch)
tree89d29082462d4bd9daa1134ca474fb89e615389e /test/node-api/test_threadsafe_function/test.js
parentab3174ca08dcc4a435d61f4ce43e5bfd8cf23115 (diff)
downloadnode-new-5705d7bf6089bb8f8a8887658f7c60de6779491c.tar.gz
n-api: make func argument of napi_create_threadsafe_function optional
PR-URL: https://github.com/nodejs/node/pull/27791 Refs: https://github.com/nodejs/node/issues/27592 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Diffstat (limited to 'test/node-api/test_threadsafe_function/test.js')
-rw-r--r--test/node-api/test_threadsafe_function/test.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/node-api/test_threadsafe_function/test.js b/test/node-api/test_threadsafe_function/test.js
index cfd0028530..3603d79ee6 100644
--- a/test/node-api/test_threadsafe_function/test.js
+++ b/test/node-api/test_threadsafe_function/test.js
@@ -102,6 +102,17 @@ new Promise(function testWithoutJSMarshaller(resolve) {
}))
.then((result) => assert.deepStrictEqual(result, expectedArray))
+// Start the thread in blocking mode, and assert that all values are passed.
+// Quit after it's done.
+// Doesn't pass the callback js function to napi_create_threadsafe_function.
+// Instead, use an alternative reference to get js function called.
+.then(() => testWithJSMarshaller({
+ threadStarter: 'StartThreadNoJsFunc',
+ maxQueueSize: binding.MAX_QUEUE_SIZE,
+ quitAfter: binding.ARRAY_LENGTH
+}))
+.then((result) => assert.deepStrictEqual(result, expectedArray))
+
// Start the thread in blocking mode with an infinite queue, and assert that all
// values are passed. Quit after it's done.
.then(() => testWithJSMarshaller({