• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4common.disableCrashOnUnhandledRejection();
5
6const expectedValueWarning = ['Symbol()'];
7const expectedDeprecationWarning = ['Unhandled promise rejections are ' +
8                                   'deprecated. In the future, promise ' +
9                                   'rejections that are not handled will ' +
10                                   'terminate the Node.js process with a ' +
11                                   'non-zero exit code.', 'DEP0018'];
12const expectedPromiseWarning = ['Unhandled promise rejection. ' +
13  'This error originated either by throwing ' +
14  'inside of an async function without a catch ' +
15  'block, or by rejecting a promise which was ' +
16  'not handled with .catch(). To terminate the ' +
17  'node process on unhandled promise rejection, ' +
18  'use the CLI flag `--unhandled-rejections=strict` (see ' +
19  'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' +
20  '(rejection id: 1)'];
21
22common.expectWarning({
23  DeprecationWarning: expectedDeprecationWarning,
24  UnhandledPromiseRejectionWarning: [
25    expectedValueWarning,
26    expectedPromiseWarning,
27  ],
28});
29
30// Ensure this doesn't crash
31Promise.reject(Symbol());
32