From b933a25ec796919d8a2c1742710961e0211b4204 Mon Sep 17 00:00:00 2001 From: Rich Trott <rtrott@gmail.com> Date: Wed, 19 Apr 2017 23:07:58 -0700 Subject: [PATCH] test: check that pending warning is emitted once Code for the new --pending-deprecation flag contains logic to make sure the deprecation warning is emitted only once. However, this was not being tested. Add test coverage for this situation. --- test/parallel/test-buffer-pending-deprecation.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/parallel/test-buffer-pending-deprecation.js b/test/parallel/test-buffer-pending-deprecation.js index fcce8814cdbd6f..e8aabc49fe0bda 100644 --- a/test/parallel/test-buffer-pending-deprecation.js +++ b/test/parallel/test-buffer-pending-deprecation.js @@ -12,4 +12,10 @@ const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' + common.expectWarning('DeprecationWarning', bufferWarning); +// This is used to make sure that a warning is only emitted once even though +// `new Buffer()` is called twice. +process.on('warning', common.mustCall()); + +new Buffer(10); + new Buffer(10);