Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): make 'v8.setFlagsFromString' a noop #19271

Merged
merged 2 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions cli/tests/unit_node/v8_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import {
getHeapStatistics,
setFlagsFromString,
} from "node:v8";
import {
assertEquals,
assertThrows,
} from "../../../test_util/std/testing/asserts.ts";
import { assertEquals } from "../../../test_util/std/testing/asserts.ts";

// https://github.com/nodejs/node/blob/a2bbe5ff216bc28f8dac1c36a8750025a93c3827/test/parallel/test-v8-version-tag.js#L6
Deno.test({
Expand Down Expand Up @@ -51,8 +48,8 @@ Deno.test({
});

Deno.test({
name: "setFlagsFromString throws",
name: "setFlagsFromString",
fn() {
assertThrows(() => setFlagsFromString("--allow_natives_syntax"));
setFlagsFromString("--allow_natives_syntax");
},
});
9 changes: 8 additions & 1 deletion ext/node/polyfills/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ export function getHeapStatistics() {
}

export function setFlagsFromString() {
notImplemented("v8.setFlagsFromString");
// NOTE(bartlomieju): From Node.js docs:
// The v8.setFlagsFromString() method can be used to programmatically set V8
// command-line flags. This method should be used with care. Changing settings
// after the VM has started may result in unpredictable behavior, including
// crashes and data loss; or it may simply do nothing.
//
// Notice: "or it may simply do nothing". This is what we're gonna do,
// this function will just be a no-op.
}
export function stopCoverage() {
notImplemented("v8.stopCoverage");
Expand Down