vapabase
vapabase•6mo ago

Run all test in sub-folder

Hey guys - day one deno newby here. Incredibly inspired by what I've been able to achieve on my first day. I just can't believe how fast tests execute. It's as though they complete as my finger barely leaves the mouse, using VS CODE test runner. I am definitely looking forward to a more integrated test-debug experience. So far I can't get the debugger config to hit a breakpoint. One thing I am unclear on, having admittedly just skimmed the documentation, is how to run all tests in subfolders, from the command line. So if I am in the root of my workspace, should I just be able to run: deno test --allow-all When I do, I get an error, "No test modules found" Thanks, and looking forward to this journey with you all!
4 Replies
vapabase
vapabase•6mo ago
One more question - as I am building code that will hopefully generate and execute Typescript dynamically. Does anybody have any articles on this topic. Remember when we used to read how bad Eval is? :p I am looking for a secure way to do all those things, without the risk of malicious code. As far as practicable of course.
Deno AI Helper
Deno AI Helper•6mo ago
Welcome to the Deno community, and I'm thrilled to hear about your positive experience with Deno's test runner in VS Code! 🦕 Regarding running tests in subfolders from the command line, the documentation states that you can run tests by calling deno test with the file that contains your test function. If you omit the file name, Deno will run all tests in the current directory and all subdirectories that match the glob {*_,*.,}test.{ts, tsx, mts, js, mjs, jsx}. This means that if you're in the root of your workspace, running deno test without any arguments should discover and run all tests that match the naming pattern described. Here's a breakdown of the glob pattern: - Files named test.{ts, tsx, mts, js, mjs, jsx}, - Files ending with .test.{ts, tsx, mts, js, mjs, jsx}, - Files ending with _test.{ts, tsx, mts, js, mjs, jsx}. If you're getting an error saying "No test modules found," it could be due to a few reasons: 1. The tests might not be named according to the patterns that Deno expects. 2. The tests might not be in the current directory or subdirectories where you're running the command. 3. There might be an issue with the permissions or the configuration of your environment. To troubleshoot this, you can try the following steps: - Ensure that your test files are named correctly according to the glob pattern. - Verify that you're in the correct directory when running the deno test command. - If you have a specific subfolder you want to test, you can specify it directly, like so: deno test subfolder/. As for the integrated test-debug experience, the documentation mentions that the VS Code extension provides integration with the built-in VSCode debugger. You can generate a configuration by going to the Run and Debug panel, clicking `create a
Deno AI Helper
Deno AI Helper•6mo ago
launch.json file, and selecting the Deno option from the available debugger options. Make sure that your Deno version is greater than 1.29 to use the --inspect-wait flag, which waits for the debugger to connect before running your code but does not break on the first line. If you're still having trouble hitting a breakpoint, ensure that: - Your Deno version supports the debugging features you're trying to use. - The debugger is properly configured in your launch.json`. - You've set breakpoints in the correct places within your code. I hope this helps you on your journey with Deno, and don't hesitate to reach out if you have more questions! 🦕
vapabase
vapabase•6mo ago
Crikey! The AI is really good 😊