Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find test files. Create one and try again #39

Closed
crutchcorn opened this issue Nov 29, 2021 · 8 comments
Closed

Could not find test files. Create one and try again #39

crutchcorn opened this issue Nov 29, 2021 · 8 comments

Comments

@crutchcorn
Copy link

When trying to run tests, I get the following error:

FAIL  src/__type_tests__/pick-deep.test-d.ts
  ● Test suite failed to run

    Could not find test files. Create one and try again

It seems like there isn't anything being found from mlh-tsd in findCustomTestFiles. If, after globby, I output:

    console.log({testFilesPattern, testFiles, cwd})

I get this:

{
  testFilesPattern: [
    'C:\\Users\\crutchcorn\\git\\UnicornUtter\\ts-util-helpers\\src\\__type_tests__\\pick-deep.test-d.ts'
  ],
  testFiles: [],
  cwd: 'C:\\Users\\crutchcorn\\git\\UnicornUtter\\ts-util-helpers'
}

My jest file is this:

module.exports = {
    runner: 'jest-runner-tsd',
    testMatch: ['**/*.test-d.ts'],
};

And my test is indeed in the pick-deep.test-d.ts path

I'm running Windows 11 if that helps

@mrazauskas
Copy link
Contributor

Thanks for report.

Most probably all got fixed in #19. I was wrestling with this error on CI. Here is the problematic line (testFiles must be globs, so slashes had to be normalised):

testFiles: [normalizeSlashes(testFile)],

Updated code is not yet released.

You can patch the library inside node_modules to see if that helps. Or we could ask @SimenB for a release (;

@SimenB
Copy link
Member

SimenB commented Nov 30, 2021

@SimenB SimenB closed this as completed Nov 30, 2021
@crutchcorn
Copy link
Author

That was fast! Thanks y'all!

Don't wanna open a new issue in case this is my fault for not noticing first. Is passing a project to tsd supported in the runner?

Something like this:

tsdjs/tsd#32 (comment)

@mrazauskas
Copy link
Contributor

Not sure I fully understand your question. Do you try to find out if the workaround will work? It should work. The runner is just a tiny wrapper around tsd.

If something does not work, better open new issue (;

@crutchcorn
Copy link
Author

crutchcorn commented Dec 1, 2021

Well, I'm admittedly not sure where to pass the second argument for said workaround 😅 to tsd (the project name) in the test runner

@mrazauskas
Copy link
Contributor

Ah.. That’s more simple with the runner. There is no need to create a dummy project. Just point to an empty .d.ts file using a docblock at the top of your test file.

See docs and example (that’s not empty .d.ts, but it should work with empty one too).

Does this help?

@crutchcorn
Copy link
Author

Oh! I read that in the docs but didn't make the connection that the two were the same. Apologies!

@mrazauskas
Copy link
Contributor

@crutchcorn Version 2.0.0 is just release. It does not require any work arounds (no more docblock, etc). Just go through the readme carefully. Many details changed.

Give it a try (;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants