node/test/abort/test-abort-backtrace.js
Ruben Bridgewater 1f85ea979c
tools: capitalize sentences
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.

PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-10 17:07:18 +01:00

29 lines
964 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
if (process.argv[2] === 'child') {
process.abort();
} else {
const child = cp.spawnSync(`${process.execPath}`, [`${__filename}`, 'child']);
const stderr = child.stderr.toString();
assert.strictEqual(child.stdout.toString(), '');
// Stderr will be empty for systems that don't support backtraces.
if (stderr !== '') {
const frames = stderr.trimRight().split('\n').map((s) => s.trim());
if (!frames.every((frame, index) => frame.startsWith(`${index + 1}:`))) {
assert.fail(`Each frame should start with a frame number:\n${stderr}`);
}
if (!common.isWindows) {
const { getBinaryPath } = require('../common/shared-lib-util');
if (!frames.some((frame) => frame.includes(`[${getBinaryPath()}]`))) {
assert.fail(`Some frames should include the binary name:\n${stderr}`);
}
}
}
}