Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors don't show when using experimental mocking #21

Open
chrisdothtml opened this issue Jul 3, 2024 · 0 comments
Open

Errors don't show when using experimental mocking #21

chrisdothtml opened this issue Jul 3, 2024 · 0 comments

Comments

@chrisdothtml
Copy link

chrisdothtml commented Jul 3, 2024

Looks like for some reason this package swallows errors if the experimental mocking is enabled.

I was setting up a basic test to play around with mocking and made a failing test like this:

import assert from 'node:assert';
import test from 'node:test';

test('greet', async (t) => {
  t.mock.module('../some-module.js', {
    namedExports: {
      greet() {
        return `Goodbye, World!`;
      },
    },
  });

  const { greet } = await import('../some-module.js');

  assert.equal(greet(), 'Hello, World!');
});

and when I ran it via:

node --test --experimental-test-module-mocks --test-reporter=@voxpelli/node-test-pretty-reporter ./greet.test.js

the only thing it emitted was this:

ℹ tests 1
ℹ suites 0
ℹ pass 0
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 214.166458

Running with the default node test reporter shows errors correctly, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant