★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/fe9888a34aNouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

test: check type for Worker filename argument

Add test to check type for first argument of Worker to increase
coverage.

PR-URL: #21620
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
  • Loading branch information...
shisama authored and targos committed Jul 1, 2018
1 parent ed774b7 commit fe9888a34a4367e90fe17d695d5ae1f555ce64da
Showing with 28 additions and 0 deletions.
  1. +28 −0 test/parallel/test-worker-type-check.js
@@ -0,0 +1,28 @@
// Flags: --experimental-worker
'use strict';

const common = require('../common');
const { Worker } = require('worker_threads');

{
[
undefined,
null,
false,
0,
Symbol('test'),
{},
[],
() => {}
].forEach((val) => {
common.expectsError(
() => new Worker(val),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "filename" argument must be of type string. ' +
`Received type ${typeof val}`
}
);
});
}

0 comments on commit fe9888a

Please sign in to comment.
You can’t perform that action at this time.