From 29593e20d54d6b9ecbdb70e85c6aa7a0ce73452a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 31 May 2018 19:46:17 +0200 Subject: [PATCH] test: run misc benchmark only once in tests Prevent misc benchmark files from running more than one benchmark during tests. PR-URL: https://github.com/nodejs/node/pull/21046 Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- benchmark/misc/util-extend-vs-object-assign.js | 4 ++++ test/parallel/test-benchmark-misc.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmark/misc/util-extend-vs-object-assign.js b/benchmark/misc/util-extend-vs-object-assign.js index 149619f6e1dea3..3880711b660fe1 100644 --- a/benchmark/misc/util-extend-vs-object-assign.js +++ b/benchmark/misc/util-extend-vs-object-assign.js @@ -9,6 +9,10 @@ const bench = common.createBenchmark(main, { }); function main({ n, type }) { + // Default value for tests. + if (type === '') + type = 'extend'; + let fn; if (type === 'extend') { fn = util._extend; diff --git a/test/parallel/test-benchmark-misc.js b/test/parallel/test-benchmark-misc.js index 96b3fe1fa2ed5a..fc7e340a80d0bb 100644 --- a/test/parallel/test-benchmark-misc.js +++ b/test/parallel/test-benchmark-misc.js @@ -9,6 +9,6 @@ runBenchmark('misc', [ 'dur=0.1', 'method=', 'n=1', - 'type=extend', - 'val=magyarország.icom.museum' + 'type=', + 'val=magyarország.icom.museum', ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });