From 75bfdad0371444ec4aa69a6f60062d0d6f0fe9ad Mon Sep 17 00:00:00 2001 From: Rich Trott 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. PR-URL: https://github.com/nodejs/node/pull/12527 Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- 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 fcce8814cdb..e8aabc49fe0 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);