Typescript tests in subfolder of routes are not executed
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
3.27.1
Plugin version
2.15.0
Node.js version
14.18.2
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20.04
Description
If you move app/test/routes/example.test.ts
to app/test/routes/subfolder/example.test.ts
, it is not longer executed when running npm run test
. This can be fixed by changing tap --ts test/**/*.test.ts
to tap --ts test/plugins test/routes
.
Steps to Reproduce
Generate an app using npx fastify-cli generate app --lang=ts
.
Run npm run test
.
Observe that 3 tests are executed.
Create a folder subfolder
inside app/test/routes
.
Move app/test/routes/example.test.ts
to app/test/routes/subfolder/example.test.ts
.
Run npm run test
.
Observe that only 2 tests are executed.
Expected Behavior
Moving tests to subfolders should not prevent their execution.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Tests are failing when in subdirectory - Stack Overflow
I am having some issues with Angular2 + TypeScript tests while trying to run them using Karma. This is my Scenario:.
Read more >Cypress - TypeScript Deep Dive - Gitbook
Feel free to create tests under subfolders for better organization e.g. ... You can run cypress tests in ci mode using the following...
Read more >Relative fs.readFileSync paths with Node.js - Ultimate Courses
Relative paths will be resolved relative to the current working directory as determined by calling process.cwd() . I was recently coding a Node....
Read more >Configuring project structure | WebStorm Documentation
Tests Tests folder folders let you keep code related to testing separately from production code. Resource Root Resources root folders: files ...
Read more >Dealing with files - Learn web development | MDN
File paths · Copy the image you chose earlier into your images folder. · Open up your index. · The line <img src=""...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found
fastify-cli
usesminimatch
for unit testing buttap
usesglob
.https://github.com/fastify/fastify-cli/blob/master/test/generate-typescript.test.js#L143-L145
https://github.com/tapjs/node-tap/blob/43bf1df7d83287ac419c9b1ad7e9c033fe3aded5/bin/run.js#L434-L439
@KXLAA you can make the Pull Request if you want to. Thank you!