mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
c714cda9a7
PR-URL: https://github.com/nodejs/node/pull/52132 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
31 lines
812 B
JavaScript
31 lines
812 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
|
|
const assert = require('assert');
|
|
|
|
// Verify that the default Error.prepareStackTrace is present.
|
|
assert.strictEqual(typeof Error.prepareStackTrace, 'function');
|
|
|
|
// Error.prepareStackTrace() can be overridden.
|
|
{
|
|
let prepareCalled = false;
|
|
Error.prepareStackTrace = (_error, trace) => {
|
|
prepareCalled = true;
|
|
};
|
|
try {
|
|
throw new Error('foo');
|
|
} catch (err) {
|
|
err.stack; // eslint-disable-line no-unused-expressions
|
|
}
|
|
assert(prepareCalled);
|
|
}
|
|
|
|
if (process.argv[2] !== 'child') {
|
|
// Verify that the above test still passes when source-maps support is
|
|
// enabled.
|
|
spawnSyncAndExitWithoutError(
|
|
process.execPath,
|
|
['--enable-source-maps', __filename, 'child']);
|
|
}
|