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