From 07e82db764b886de258cfddf92254bda309117dd Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 20 Dec 2019 12:16:36 -0500 Subject: [PATCH] test: get lib/wasi.js coverage to 100% MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit covers the last remaining uncovered code in lib/wasi.js. PR-URL: https://github.com/nodejs/node/pull/31039 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Richard Lau Reviewed-By: Yongsheng Zhang Reviewed-By: Michaƫl Zasso Reviewed-By: Stephen Belanger --- test/wasi/test-wasi-options-validation.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/wasi/test-wasi-options-validation.js b/test/wasi/test-wasi-options-validation.js index fe23e446b08733..f07046b833d3ee 100644 --- a/test/wasi/test-wasi-options-validation.js +++ b/test/wasi/test-wasi-options-validation.js @@ -20,3 +20,9 @@ assert.throws(() => { new WASI({ env: 'fhqwhgads' }); }, // If preopens is not an Object and not undefined, it should throw. assert.throws(() => { new WASI({ preopens: 'fhqwhgads' }); }, { code: 'ERR_INVALID_ARG_TYPE', message: /\bpreopens\b/ }); + +// If options is provided, but not an object, the constructor should throw. +[null, 'foo', '', 0, NaN, Symbol(), true, false, () => {}].forEach((value) => { + assert.throws(() => { new WASI(value); }, + { code: 'ERR_INVALID_ARG_TYPE' }); +});