From 2bde4f64d0acdb1212281225665249d73876b25d Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Mon, 23 Jan 2017 12:39:51 -0500 Subject: [PATCH] Revise node.js definition to respond to feedback on PR #13877 --- node/index.d.ts | 6 ++---- node/node-tests.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 32d3f5a203..6e4fbce84e 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -4016,10 +4016,8 @@ declare module "v8" { physical_space_size: number; } - enum DoesZapCodeSpaceFlag { - Disabled = 0, - Enabled = 1 - } + //** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ + type DoesZapCodeSpaceFlag = 0 | 1; interface HeapInfo { total_heap_size: number; diff --git a/node/node-tests.ts b/node/node-tests.ts index 2844ca8e6e..03c3e9a1b6 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -24,6 +24,7 @@ import * as string_decoder from "string_decoder"; import * as stream from "stream"; import * as timers from "timers"; import * as repl from "repl"; +import * as v8 from "v8"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; @@ -2071,6 +2072,21 @@ namespace constants_tests { str = constants.defaultCipherList } + +//////////////////////////////////////////////////// +/// v8 tests : https://nodejs.org/api/v8.html +//////////////////////////////////////////////////// + +namespace v8_tests { + + const heapStats = v8.getHeapStatistics(); + const heapSpaceStats = v8.getHeapSpaceStatistics(); + + const zapsGarbage: number = heapStats.does_zap_garbage; + + v8.setFlagsFromString('--collect_maps'); +} + /////////////////////////////////////////////////////////// /// Debugger Tests /// ///////////////////////////////////////////////////////////