AleG94 / mocha-suppress-logs

Suppress console output of successful mocha tests
MIT License
13 stars 3 forks source link

0.4.0 breaks test output #11

Closed johnjeffers closed 8 months ago

johnjeffers commented 11 months ago

0.4.0 is suppressing all of the test output. Rolling back to 0.3.1 restored normal behavior.

Output from 0.3.1:

npm test

> fusionauth-site-origin-handler@1.0.0 test
> mocha --require mocha-suppress-logs

  test-1
    ✔ /something.html (344ms)

  test-2
    ✔ /docs (123ms)
    ✔ /docs/ (71ms)

  3 passing (544ms)

Output from 0.4.0:

» npm test

> fusionauth-site-origin-handler@1.0.0 test
> mocha --require mocha-suppress-logs

  test-1

  test-2

  3 passing (533ms)

In my test file, I'm using standard node:assert

import assert from 'node:assert/strict';

An example test looks like this:

describe('test-1', function() {
  it('/something.html', async function() {
    result = await handler(mockEvent('/something.html'), null)
    assert.deepEqual(result, makeRedirect('/something'));
  });
});
node --version
v21.1.0

Let me know if you need any more info.

vassudanagunta commented 11 months ago

Confirmed this is an issue. Looks like the fix for #8 and #9 has an unintended side-affect.

@AleG94 I highly recommend using @gmrchk/cli-testing-library to add functional tests. You can use it to make assertions on the output of CLI-based execution, e.g. stdout from the execution of mocha tests.

AleG94 commented 11 months ago

Just released a fix for this with 0.4.1, hoping I'm not missing any particular use case.

Please let me know if everything is working fine for you as well.

Thanks @vassudanagunta for suggesting that awesome package, I did not have time to implement it right now but I will try for the next releases!

vassudanagunta commented 11 months ago

Fast turnaround! Confirmed that this has been fixed (and 8 and 9 haven't regressed).

I did not have time to implement it right now but I will try for the next releases!

Do you want me to submit a PR with a single example test using that package to save you the time of figuring it out?