Skip to content

Commit 9ff2e82

Browse files
authored
test: fix race condition (#90)
* fix: race condition in unit test * chore: lint fix
1 parent c64eb06 commit 9ff2e82

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/multithreading-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ test('check multithreading flag works as expected', async function (t) {
2525
t.plan(9)
2626
const location = tempy.directory()
2727
const db1 = new ClassicLevel(location)
28-
const db2 = new ClassicLevel(location)
29-
30-
// check that must set multithreading flag on all instances
3128
await db1.open()
3229
t.is(db1.location, location)
30+
31+
// check that must set multithreading flag on all instances
32+
let db2
3333
try {
34+
db2 = new ClassicLevel(location)
3435
await db2.open({ multithreading: true })
3536
} catch (err) {
3637
t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN', 'second instance failed to open')

0 commit comments

Comments
 (0)