From c87259671e6f487a97ba87de9d13256a70ed991b Mon Sep 17 00:00:00 2001 From: pubkey <8926560+pubkey@users.noreply.github.com> Date: Thu, 23 Dec 2021 21:36:38 +0100 Subject: [PATCH] FIX test --- .gitignore | 1 + .npmignore | 1 + src/broadcast-channel.js | 3 ++- test/integration.test.js | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6673e706..792d139d 100755 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ package-lock.json shelljs_* test_tmp/ tmp/ +.eslintcache diff --git a/.npmignore b/.npmignore index e02a6e35..edca51b8 100644 --- a/.npmignore +++ b/.npmignore @@ -9,6 +9,7 @@ babel.config.js .editorconfig .eslintignore .eslintrc.json +.eslintcache .gitignore .travis.yml renovate.json diff --git a/src/broadcast-channel.js b/src/broadcast-channel.js index 308ed906..4c8ecb19 100644 --- a/src/broadcast-channel.js +++ b/src/broadcast-channel.js @@ -255,7 +255,8 @@ function _startListening(channel) { * Not doing this would make messages missing when we send data directly after subscribing and awaiting a response. * @link https://johnresig.com/blog/accuracy-of-javascript-time/ */ - const minMessageTime = listenerObject.time - 100; + const hundredMsInMicro = 100 * 1000; + const minMessageTime = listenerObject.time - hundredMsInMicro; if (msgObj.time >= minMessageTime) { listenerObject.fn(msgObj.data); diff --git a/test/integration.test.js b/test/integration.test.js index 3db387a3..3d75dc87 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -198,7 +198,7 @@ function runTest(channelOptions) { * Becuase the JavaScript time precision is not good enough, we also emit messages that are only a bit off. * This ensures we do not miss out messages which would be way more critical then getting additionals. */ - await wait(200); + await AsyncTestUtil.wait(200); const emitted = []; channel2.onmessage = msg => emitted.push(msg);