diff --git a/test/parallel/test-whatwg-encoding-custom-textdecoder.js b/test/parallel/test-whatwg-encoding-custom-textdecoder.js index fe08edc597d3f4..74c6a002223255 100644 --- a/test/parallel/test-whatwg-encoding-custom-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-custom-textdecoder.js @@ -201,8 +201,13 @@ if (common.hasIntl) { } if (common.hasIntl) { - const decoder = new TextDecoder('Shift_JIS'); - const chunk = new Uint8Array([-1]); - const str = decoder.decode(chunk); - assert.strictEqual(str, '\ufffd'); + try { + const decoder = new TextDecoder('Shift_JIS'); + const chunk = new Uint8Array([-1]); + const str = decoder.decode(chunk); + assert.strictEqual(str, '\ufffd'); + } catch (e) { + // Encoding may not be available, e.g. small-icu builds + assert.strictEqual(e.code, 'ERR_ENCODING_NOT_SUPPORTED'); + } }