analog icon indicating copy to clipboard operation
analog copied to clipboard

No console logs when testing

Open DevWedeloper opened this issue 1 year ago • 4 comments

Please provide the environment you discovered this bug in.

Windows 10

Which area/package is the issue in?

vitest-angular

Description

console.logs aren't appearing on the terminal when running tests

Please provide the exception or error you saw

No response

Other information

Similar issue here

I would be willing to submit a PR to fix this issue

  • [ ] Yes
  • [X] No

DevWedeloper avatar Jun 26 '24 21:06 DevWedeloper

One way is to call vitest --disableConsoleIntercept.

Another, is to tinker the config:

export default defineConfig(({ mode }) => {
  return {
    plugins: [angular(), nxViteTsPaths()],
    test: {
      globals: true,
      environment: 'jsdom',
      setupFiles: ['src/test-setup.ts'],
      include: ['**/*.spec.ts'],
      reporters: ['default'],
      disableConsoleIntercept: true, // <-- here
    },
    define: {
      'import.meta.vitest': mode !== 'production',
    },
  };
});

Not sure why it's not present in the docs, but the IDE discovers it perfectly fine, and it also works image

gultyayev avatar Jul 02 '24 18:07 gultyayev

I have tried that on a fresh analog app and it's not working.

DevWedeloper avatar Jul 02 '24 21:07 DevWedeloper

Could you provide a repro

gultyayev avatar Jul 03 '24 05:07 gultyayev

Could you provide a repro

Can you make a fresh analog app and test on your end? Just to make sure I'm not having an isolated case

DevWedeloper avatar Jul 03 '24 07:07 DevWedeloper

Could be related https://github.com/vitest-dev/vitest/pull/5678

gultyayev avatar Jul 08 '24 17:07 gultyayev