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

No console logs when testing #1180

Open
1 of 2 tasks
DevWedeloper opened this issue Jun 26, 2024 · 5 comments
Open
1 of 2 tasks

No console logs when testing #1180

DevWedeloper opened this issue Jun 26, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@DevWedeloper
Copy link

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
  • No
@DevWedeloper DevWedeloper added the bug Something isn't working label Jun 26, 2024
@gultyayev
Copy link
Contributor

gultyayev commented Jul 2, 2024

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

@DevWedeloper
Copy link
Author

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

@gultyayev
Copy link
Contributor

Could you provide a repro

@DevWedeloper
Copy link
Author

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

@gultyayev
Copy link
Contributor

Could be related vitest-dev/vitest#5678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants