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

[bug] regression: deno test Cannot resolve module "<dir>/test" #3919

Closed
brandonkal opened this issue Feb 8, 2020 · 12 comments
Closed

[bug] regression: deno test Cannot resolve module "<dir>/test" #3919

brandonkal opened this issue Feb 8, 2020 · 12 comments

Comments

@brandonkal
Copy link
Contributor

I mentioned this on the Gitter earlier and do not see an open issue here to track this.

Deno is trying to find a file named "test" rather than using the test subcommand as specified.

@brandonkal brandonkal mentioned this issue Feb 8, 2020
43 tasks
@bartlomieju
Copy link
Member

Just tried with 0.32.0 - it works just fine.

Does this happen on master?

@brandonkal
Copy link
Contributor Author

Weird. I'm using the 0.32.0 release on Linux.

@bartlomieju
Copy link
Member

@brandonkal can you share terminal output?

@brandonkal
Copy link
Contributor Author

brandonkal commented Feb 8, 2020

Sure but there is no output beyond what is in the title
In a folder containing only this file:

// broken.test.ts
import { test as it } from 'https://deno.land/std@v0.32.0/testing/mod.ts'
import { assertEquals } from 'https://deno.land/std@v0.32.0/testing/asserts.ts'

it('works', () => {
	assertEquals(10, 10)
})
$ deno -A test
Cannot resolve module "file:///home/brandon/broken-deno-test/test"

But this works:

deno -A https://deno.land/std@v0.32.0/testing/runner.ts $(fd test)

@nayeemrmn
Copy link
Collaborator

nayeemrmn commented Feb 8, 2020

You need to specify the perm flags after the subcommand, since not every subcommand has them. The logic behind that should be clear. Thus deno -A is assumed to be the deno -A <script> usage. Have you tried the command in the title of this issue?

@brandonkal
Copy link
Contributor Author

Permission flag after subcommand is confusing.
I see test as shorthand for https://deno.land/std@v0.32.0/testing/runner.ts

It is still broken though

brandon@dev:~/broken-deno-test$ deno test -A
No matching test modules found.
brandon@dev:~/broken-deno-test$ deno test -A .
No matching test modules found.
brandon@dev:~/broken-deno-test$ deno test
No matching test modules found.
brandon@dev:~/broken-deno-test$ ls
broken.test.ts

@nayeemrmn
Copy link
Collaborator

nayeemrmn commented Feb 8, 2020

Permission flag after subcommand is confusing.

Subcommand-specific flags go after the subcommand.

brandon@dev:~/broken-deno-test$ ls
broken.test.ts

Run deno https://deno.land/std@v0.32.0/testing/runner.ts --help to see what filename patterns are detected by the default/directory glob -- that isn't one of them.

@brandonkal
Copy link
Contributor Author

It should be one of them

@nayeemrmn
Copy link
Collaborator

Found it: #2947 :) You can close this if the other problems are okay.

@brandonkal
Copy link
Contributor Author

"test" is never a valid module name because it is extensionless. Therefore,
a more helpful output must be provided ("Did you mean deno test -A?")

I have also seen the "Cannot resolve module" error with just deno test but I am fine ignoring that because I can't reproduce it reliably.

@nayeemrmn
Copy link
Collaborator

@brandonkal Yeah, "smart" flag error messages are commonly suggested. Another one is where a perm error occurs and the relevant perm flag is detected in the script args. Could you open a new issue?

@nayeemrmn
Copy link
Collaborator

@bartlomieju Can this be closed?

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