node/test/parallel/test-fs-internal-assertencoding.js
Antoine du Hamel 17fba608ae
test: ensure assertions are reached on more tests
PR-URL: https://github.com/nodejs/node/pull/60726
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-11-17 22:10:40 +01:00

16 lines
511 B
JavaScript

'use strict';
// Tests to verify that a correctly formatted invalid encoding error
// is thrown. Originally the internal assertEncoding utility was
// reversing the arguments when constructing the ERR_INVALID_ARG_VALUE
// error.
require('../common');
const { opendirSync } = require('node:fs');
const assert = require('node:assert');
assert.throws(() => opendirSync('.', { encoding: 'no' }), {
code: 'ERR_INVALID_ARG_VALUE',
message: 'The argument \'encoding\' is invalid encoding. Received \'no\'',
});