Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Running jest leads to "TypeError: Path must be a string" #124

Closed
mknet opened this issue Oct 17, 2017 · 4 comments
Closed

Running jest leads to "TypeError: Path must be a string" #124

mknet opened this issue Oct 17, 2017 · 4 comments
Labels

Comments

@mknet
Copy link

mknet commented Oct 17, 2017

My test file

let loader = require("@std/esm")(module, { cjs: true, esm: "js" });
const RenderStreamFactory = loader("./RenderStreamFactory.js").default;

let renderStreamFactory = new RenderStreamFactory();

test('adds 1 + 2 to equal 3', () => {
    expect(renderStreamFactory).toBeNull();
  });

When im invoking jest vom the CLI I get

FAIL  src/RenderStreamFactory.test.js
  ● Test suite failed to run

    TypeError: Path must be a string. Received undefined
      
      at assertPath (path.js:28:11)
      at Object.relative (path.js:1268:5)

If I'm using the loader config in another context without Jest it works fine.
Using version 0.11.3 of @std/ESM

Thanks for your help

@jdalton
Copy link
Member

jdalton commented Oct 17, 2017

Hi @mknet!

Could you create a simple repro repo? I've fixed a similar issue before.

@mknet
Copy link
Author

mknet commented Oct 18, 2017

Hey @jdalton,

yeah, I noticed the other issue but since I got another error back I created a separate issue.

I created a repro repo with a simple example. I hope you get the same result.

@jdalton
Copy link
Member

jdalton commented Oct 18, 2017

Thanks @mknet!

I can't repro with jest v21.2.1

Maybe you need to clear your node_modules folder.

@mknet
Copy link
Author

mknet commented Oct 19, 2017

Oh boy, yeah, the global installation of jest was outdated. Sorry to bother you and thanks for your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants