Open peterpeterparker opened 5 months ago
For me, using showCanisterLogs
allows me to see ic_cdk::print
calls in my canister when using Jest or Bun, but I've had some issues related to Vitest swallowing console logs. Maybe something here will help you: https://github.com/vitest-dev/vscode/discussions/117.
Thanks for the feedback. I actually have no issue with console.log
and vitest. It's stricly the ic_cdk::print
that I did not managed to print out. 🤷♂️
I guess the documentation is then clear enough and if it works with jest and bun, then I guess something fishy on my hand. I'll close this.
Found it! I read the thread you shared again, thanks a lot, and noticed that --reporter
was mentionned few times which resolved the issue - i.e. specifying the basic
reporter.
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globalSetup: './vitest.setup.ts',
globals: true,
watch: false,
silent: false,
reporters: ['basic'],
environment: 'node',
poolOptions: {
threads: {
singleThread: true
}
}
},
resolve: {
alias: [
{
find: '$declarations',
replacement: resolve(__dirname, 'src/declarations')
}
]
}
});
Awesome, thanks for letting me know. I re-opened the issue as a reminder for me to add a note about this into the docs :)
Hi,
I followed the running-tests documentation and tried both options
showCanisterLogs
andshowRuntimeLogs
but, none of those allowed me to retrieve theic_cdk::print
I logged in my canister.Therefore, I'm not sure if it's a potential issue or a feature. If the first, maybe I missed something (I'm using vitest), if the latest, it would maybe be nice to clarify that in the documentation.
Best