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] PnP cannot find ava #1760

Closed
1 task
FallingSnow opened this issue Aug 24, 2020 · 1 comment
Closed
1 task

[Bug] PnP cannot find ava #1760

FallingSnow opened this issue Aug 24, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@FallingSnow
Copy link

  • I'd be willing to implement a fix

Describe the bug

Using yarn's PnP feature with AVA test tool results in strange ava not found when I try to import it. But it does say did you mean ava-npm-3.11.1.... I've also tried using yarn pnpify ava but it's the same issue.

$ yarn run test      // "test": "ava"
Uncaught exception in test/database.spec.mjs

  Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ava' imported from /project/test/database.spec.mjs
  Did you mean to import ava-npm-3.11.1-eda34ac446-282cb94428.zip/node_modules/ava/index.js?

   Did you mean to import ava-npm-3.11.1-eda34ac446-282cb94428.zip/node_modules/ava/index.js?
   packageResolve (internal/modules/esm/resolve.js:620:9)
   moduleResolve (internal/modules/esm/resolve.js:659:14)
   Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:752:11)
   Loader.resolve (internal/modules/esm/loader.js:97:40)
   Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
   ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:50:40)
   link (internal/modules/esm/module_job.js:49:36)

To Reproduce

database.spec.mjs
import test from "ava";
import {resolve, basename} from "path";

import {Database} from "../lib/database.ts";

const db = new Database();

test("create user", async (t) => {
const info = {
  firstName: "foo",
  lastName: "bar"
}
db.newUser(info);
});
Package.json AVA settings
"ava": {
  "require": [
    "ts-node/register"
  ],
  "babel": true,
  "files": [
    "test/**.spec.js",
    "test/**.spec.mjs"
  ]
}

Environment if relevant (please complete the following information):

  • OS: Linux 5.8.3-arch1-1 👑 Say hello to Yarn 2 #1 SMP PREEMPT Fri, 21 Aug 2020 16:54:16 +0000 x86_64 GNU/Linu
  • Node version: v14.4.0
  • Yarn version: 2.1.1
  • Typescript version: 4.0.2
@FallingSnow FallingSnow added the bug Something isn't working label Aug 24, 2020
@arcanis
Copy link
Member

arcanis commented Aug 24, 2020

Probably a duplicate of #638

@arcanis arcanis closed this as completed Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants