tutorialkit
tutorialkit copied to clipboard
Show tests results in preview
Hello!
We'd like to add a "Run tests" button near the current "Toggle terminal", which would npm run test and show results instead of preview.
How should we approach this? Especially regarding replacing the "Preview" with the npm run test output?
The Toggle terminal button cannot be replaced with custom buttons. However you can hide the button by specifying previews: false, and provide your own Run tests button in the lesson content.
Here's example where preview is not shown, and by clicking Run tests user can see results of that instead of the preview: https://tutorialkit.dev/guides/how-to-use-tutorialkit-api/#write-to-terminal
https://github.com/user-attachments/assets/167c33de-e0f4-46f7-af9a-43c9ec73afde
Thank you for the response!
UX-wise, it would be great if we could have the button to run tests somewhere near the code (e.g. near "Solve" or "Toggle terminal"). And also open the results/switch to the test results terminal instead of the preview.
I wonder if you have anything like this on the roadmap ;)