node.js - Strange Mocha Failure when running all scripts -


i have following mocha test:

it('with numeric delay, querying returns asynchronous result', async() => {   const m = new mock();   m.addschema('foo', mocker);   m.addschema('bar', mocker);   m.queueschema('foo', 5).queueschema('bar', 5).generate();   m.setdelay(100);   const results = await m.ref('/foos').once('value');   expect(results.numchildren()).is.equal(5);   expect(helpers.firstrecord(results.val()).name).to.be.a('string');   expect(helpers.firstrecord(results.val()).age).to.be.a('number'); }); 

what i'm baffled that:

  • when run through node debugger executes without error.
  • when test using wallabyjs executes without error.
  • when run terminal specifying test script test in executes without error!!!

but, when run terminal , run all tests gives me following:

assertionerror: expected 0 equal 5 @ m.ref.once.then (test/reference-spec.ts:103:44)

the precise command i'm using scripts is:

mocha --compilers ts:ts-node/register --compileroptions --require ts-node/register --recursive test/**/*-spec.ts

and test file issue:

mocha --compilers ts:ts-node/register --compileroptions --require ts-node/register test/reference-spec.ts

even stranger call async function once() in several other places in same test file these not exhibit same behavior.


the problematic test script can found here: test script

the once() method found here: query.ts


enter image description here


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -