node/test/parallel/test-structuredClone-global.js
Giora Guttsait b27ae24dcc
lib: throw error in structuedClone when no arguments are passed
PR-URL: https://github.com/nodejs/node/pull/41651
Fixes: https://github.com/nodejs/node/issues/41450
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-01-24 23:17:37 +00:00

24 lines
532 B
JavaScript

// Flags: --expose-internals
'use strict';
/* eslint-disable no-global-assign */
require('../common');
const {
structuredClone: _structuredClone,
} = require('internal/structured_clone');
const {
strictEqual,
throws,
} = require('assert');
strictEqual(globalThis.structuredClone, _structuredClone);
structuredClone = undefined;
strictEqual(globalThis.structuredClone, undefined);
// Restore the value for the known globals check.
structuredClone = _structuredClone;
throws(() => _structuredClone(), /ERR_MISSING_ARGS/);