• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3const assert = require('assert');
4const helper = require('../common/report');
5
6{
7  // Test with no arguments.
8  helper.validateContent(process.report.getReport());
9  assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
10}
11
12{
13  // Test with an error argument.
14  helper.validateContent(process.report.getReport(new Error('test error')));
15  assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
16}
17
18{
19  // Test with an error with one line stack
20  const error = new Error();
21  error.stack = 'only one line';
22  helper.validateContent(process.report.getReport(error));
23  assert.deepStrictEqual(helper.findReports(process.pid, process.cwd()), []);
24}
25
26{
27  const error = new Error();
28  error.foo = 'goo';
29  helper.validateContent(process.report.getReport(error),
30                         [['javascriptStack.errorProperties.foo', 'goo']]);
31}
32
33// Test with an invalid error argument.
34[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => {
35  assert.throws(() => {
36    process.report.getReport(error);
37  }, { code: 'ERR_INVALID_ARG_TYPE' });
38});
39