diff options
Diffstat (limited to 'node_modules/fastq/test')
| -rw-r--r-- | node_modules/fastq/test/example.ts | 2 | ||||
| -rw-r--r-- | node_modules/fastq/test/test.js | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/fastq/test/example.ts b/node_modules/fastq/test/example.ts index c454e9d0..a47d4419 100644 --- a/node_modules/fastq/test/example.ts +++ b/node_modules/fastq/test/example.ts @@ -32,6 +32,8 @@ queue.pause() queue.resume() +queue.running() + queue.saturated = () => undefined queue.unshift('world', (err, result) => { diff --git a/node_modules/fastq/test/test.js b/node_modules/fastq/test/test.js index 1cc78a56..accbaf94 100644 --- a/node_modules/fastq/test/test.js +++ b/node_modules/fastq/test/test.js @@ -564,3 +564,19 @@ test('push with worker throwing error', function (t) { t.match(err.message, /test error/, 'error message should be "test error"') }) }) + +test('unshift with worker throwing error', function (t) { + t.plan(5) + var q = buildQueue(function (task, cb) { + cb(new Error('test error'), null) + }, 1) + q.error(function (err, task) { + t.ok(err instanceof Error, 'global error handler should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + t.equal(task, 42, 'The task executed should be passed') + }) + q.unshift(42, function (err) { + t.ok(err instanceof Error, 'unshift callback should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + }) +}) |
