Managing Test Scripts
How to manage multiple test scripts so they will be detected on the Test Explorer?
2 Replies
is this a good practice?
To ensure that your multiple test scripts are detected and managed properly in the Test Explorer, you should follow these guidelines based on the documentation:
1. File Inclusion/Exclusion: Make sure that your test files are included in the set of files that the Test Explorer recognizes. This can be configured using the
deno.json
configuration file, specifically with the test.include
and test.exclude
fields. By setting these fields, you can control which files are considered for testing and which are ignored.
2. Unique Test Step Names: If you are using test steps, ensure that each test step has a unique name. There were issues with the Test Explorer freezing or not updating correctly when test steps with the same name were not registered uniquely, but this has been fixed in the latest release.
3. Running Tests: When running tests from the Test Explorer, it will no longer evaluate modules that don't contain any tests, and modules without tests will not be shown in the Test Explorer. This helps to keep the Test Explorer clean and focused on actual test files.
4. Test Execution: If you have tests with the { only: true }
option set, running a single test via code lens will now behave as expected and properly ignore other tests. This means you can focus on running a specific test without interference from others marked as only
.
5. File Filtering: The Test Explorer and the Run test code lens now filter files based on the exclude
, test.exclude
, and test.include
fields in deno.json
. This helps in managing which test scripts are detected and displayed.
By following these guidelines, you should be able to manage your test scripts effectively and ensure that they are properly detected and displayed in the Test Explorer. 🦕Helpful Links:
Deno 1.37: Modern JavaScript in Jupyter Notebooks
Build and Ship Astro Sites with Deno and Deno Deploy
Behavior-Driven Development | Deno Docs
dnt — the easiest way to publish a hybrid npm module for ESM and CommonJS
First Steps | Deno Docs
Deno 1.4 Release Notes
Deno Runtime Quick Start | Deno Docs