question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsdx lint errors out if you have co-located test files (i.e. no test dir)

See original GitHub issue

Current Behavior

Added tsdx to a project where test files are in the same dirs as the files under test like this:

src/
  dir1/
    file1.ts
    file1.test.ts

… and ran npm run lint. This is the error generated:

Error: No files matching 'test' were found.

The linter doesn’t finish running because of it.

Desired Behavior

Linter doesn’t error out due to this project structure.

Suggested Solution

Since this is a common project configuration to ensure you have a test suite per file, either edit the default configuration to support this setup or add a flag to tsdx create or tsdx lint that supports it.

Who does this impact? Who is this for?

All users, potentially. Specifically, people who have their test files next to their files under test in their dir structure.

Describe alternatives you’ve considered

  • A tsdx eject command that lets you override these settings (sort of against the spirit of the project, though)
  • Stopping writing tests with this style (but the benefits outweigh the costs)

Additional context

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
arthurdennercommented, Nov 22, 2019

@pcowgill, once this PR gets merged, we can change the behavior.

0reactions
pcowgillcommented, Nov 22, 2019

@arthurdenner Perfect, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Log - TSDX
The world's leading companies use TSDX to build and test TypeScript packages. ... to: txt (typescript) Error: ENOENT: no such file or directory,...
Read more >
Linting errors in react testing - typescript - Stack Overflow
In this case you want to remove the type annotation for TEST_KEY which will make it typed as just string . But then...
Read more >
Automated Code Linting and Testing | by Harsh Verma - Medium
Think of setup which solves above drawbacks i.e. will not allow to commit the code without eslint fix ,fix some linting issue or...
Read more >
dts-cli | Yarn - Package Manager
Runs your tests using Jest. npm run lint or yarn lint. Runs Eslint with Prettier on .ts and .tsx files. If you want...
Read more >
lint-staged - npm
By doing so you can ensure no errors go into the repository and ... JS files inside the /foo directory, so /foo/bar/test.js but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found