summaryrefslogtreecommitdiff
path: root/test/parallel/test-trace-events-fs-sync.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-09-17 15:34:31 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-09-18 13:12:34 +0200
commit9ccf5c8954b8260d1a016c9b1442012ad8626bea (patch)
tree96dc32f562b8017530a0672a438781c8de061fe0 /test/parallel/test-trace-events-fs-sync.js
parenta9e7369b117f857f24ed67ece1f212b4b605c584 (diff)
downloadandroid-node-v8-9ccf5c8954b8260d1a016c9b1442012ad8626bea.tar.gz
android-node-v8-9ccf5c8954b8260d1a016c9b1442012ad8626bea.tar.bz2
android-node-v8-9ccf5c8954b8260d1a016c9b1442012ad8626bea.zip
test: don't inspect values if not necessary
The inspection triggered on each assert call eagerly even tough the assertion was never triggered. That caused significant CPU overhead. PR-URL: https://github.com/nodejs/node/pull/22903 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-trace-events-fs-sync.js')
-rw-r--r--test/parallel/test-trace-events-fs-sync.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/parallel/test-trace-events-fs-sync.js b/test/parallel/test-trace-events-fs-sync.js
index 71ffc9da72..54222bcb33 100644
--- a/test/parallel/test-trace-events-fs-sync.js
+++ b/test/parallel/test-trace-events-fs-sync.js
@@ -136,7 +136,12 @@ for (const tr in tests) {
}
// Make sure the operation is successful.
- assert.strictEqual(proc.status, 0, `${tr}:\n${util.inspect(proc)}`);
+ // Don't use assert with a custom message here. Otherwise the
+ // inspection in the message is done eagerly and wastes a lot of CPU
+ // time.
+ if (proc.status !== 0) {
+ throw new Error(`${tr}:\n${util.inspect(proc)}`);
+ }
// Confirm that trace log file is created.
assert(fs.existsSync(traceFile));