Silvain
Silvain
CDCloudflare Developers
Created by Silvain on 3/25/2024 in #vitest-integration-beta
Why am i not seeing my console.log
Thank you for your help!
5 replies
CDCloudflare Developers
Created by Silvain on 3/25/2024 in #vitest-integration-beta
Why am i not seeing my console.log
sorry for late reply, i figured it out. Added to my vitest.config.ts: ... fileParallelism: false, reporters: ['basic'], ... That fixed it.
5 replies
CDCloudflare Developers
Created by Silvain on 3/25/2024 in #vitest-integration-beta
Why am i not seeing my console.log
I simplified it a bit too much 😉 Below is corrected code. But I think it's an issue with vitest handling of console.log. When I use "vitest --run" it doesn't show either of the console.log results. When I use "vitest --watch" it doesn't show the output either, or sometimes only the first (after repeats). But when I place a "expect(1).toBe(0)" after the second console.log, both outputs are shown. Probably a vitest thingie that it only shows console.log in case of failure or something like that .. weird. (i'm used to jest)
/* myapp.tsx */
import { Hono } from 'hono';

const myapp = new Hono();
myapp.get('/', (c) => c.html(<p>Hello world</p>));

export default myapp;

/* app.test.ts */
import myapp from './myapp';

describe('my-test', () => {
it('should work', async () => {
console.log('BEFORE');
await myapp.request('/');
console.log('AFTER');
// expect(1).toBe(0)
});
});

/* vitest.config.ts */
{ .... singleWorker: true .... }

/* run vitest */
npx vitest --no-file-parallelism --disable-console-intercept --run
/* myapp.tsx */
import { Hono } from 'hono';

const myapp = new Hono();
myapp.get('/', (c) => c.html(<p>Hello world</p>));

export default myapp;

/* app.test.ts */
import myapp from './myapp';

describe('my-test', () => {
it('should work', async () => {
console.log('BEFORE');
await myapp.request('/');
console.log('AFTER');
// expect(1).toBe(0)
});
});

/* vitest.config.ts */
{ .... singleWorker: true .... }

/* run vitest */
npx vitest --no-file-parallelism --disable-console-intercept --run
5 replies