mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
Tests should be explicit regarding whether a promise is expected to settle, and the test should fail when the behavior does not meet expectations. PR-URL: https://github.com/nodejs/node/pull/60976 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
38 lines
775 B
JavaScript
38 lines
775 B
JavaScript
// Flags: --expose-gc
|
|
|
|
'use strict';
|
|
const common = require('../common');
|
|
const {
|
|
assertSummaryShape,
|
|
expectExperimentalWarning
|
|
} = require('../common/measure-memory');
|
|
const vm = require('vm');
|
|
|
|
expectExperimentalWarning();
|
|
|
|
// Test lazy memory measurement - we will need to globalThis.gc()
|
|
// or otherwise these may not resolve.
|
|
{
|
|
vm.measureMemory()
|
|
.then(assertSummaryShape).then(common.mustCall());
|
|
globalThis.gc();
|
|
}
|
|
|
|
{
|
|
vm.measureMemory({})
|
|
.then(assertSummaryShape).then(common.mustCall());
|
|
globalThis.gc();
|
|
}
|
|
|
|
{
|
|
vm.measureMemory({ mode: 'summary' })
|
|
.then(assertSummaryShape).then(common.mustCall());
|
|
globalThis.gc();
|
|
}
|
|
|
|
{
|
|
vm.measureMemory({ mode: 'detailed' })
|
|
.then(assertSummaryShape).then(common.mustCall());
|
|
globalThis.gc();
|
|
}
|