From 1fceb14e32ccc064e4897c53457fae66a7aa0ac8 Mon Sep 17 00:00:00 2001 From: Nodar Chkuaselidze Date: Sat, 18 May 2019 16:36:38 +0400 Subject: [PATCH] blockstore-test: use try/catch instead of promise.catch/finally. finally was introduce in node v10, so this test will fail on v8.6.0 node. --- test/blockstore-test.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/test/blockstore-test.js b/test/blockstore-test.js index 39a777dc..df667f3e 100644 --- a/test/blockstore-test.js +++ b/test/blockstore-test.js @@ -813,17 +813,20 @@ describe('BlockStore', function() { // Accidentally don't use `await` and attempt to // write multiple blocks in parallel and at the // same file position. - const promise = store.write(hash, block); - promise.catch((e) => { - err = e; - }).finally(() => { - finished += 1; - if (finished >= 16) { - assert(err); - assert(err.message, 'Already writing.'); - done(); + (async () => { + try { + await store.write(hash, block); + } catch (e) { + err = e; + } finally { + finished += 1; + if (finished >= 16) { + assert(err); + assert(err.message, 'Already writing.'); + done(); + } } - }); + })(); } });