From 624a403f5b7fb732333a7e09ae29b0431a4cb553 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% This commit covers the last remaining uncovered code in lib/wasi.js. --- 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' }); +});