open-wc icon indicating copy to clipboard operation
open-wc copied to clipboard

Cannot find module '@esm-bundle/chai' from 'node_modules/@open-wc/testing/index.js'

Open olscode opened this issue 3 years ago • 5 comments

When i run yarn test to execute "jest" command it says:

Cannot find module '@esm-bundle/chai' from 'node_modules/@open-wc/testing/index.js' image

import { fixture, fixtureCleanup } from "@open-wc/testing";
import { html } from "lit-element";
import type * as Silly from "./silly"
// requireActual ensures you get the real file
// instead of an automock
// we use import type and <typeof ...> to still get types
const { sillyFunction } = jest.requireActual<typeof Silly>("./silly")

describe("silly function", () => {
  test("guaranteed random", () => {
    expect(sillyFunction()).toBe(4)
  })
})

Versions i am using: "@open-wc/testing": "^3.1.7" "jest": "^29.3.1" "typescript": "^4.9.4" "ts-jest": "^29.0.5"

I used @open-wc/testing-helpers and it works perfectly but its not working with @open-wc/testing

olscode avatar Jan 22 '23 02:01 olscode

+1 having the same problem with pnpm and Vitest

jaa134 avatar Apr 24 '23 19:04 jaa134

running into this issue as well. any luck?

ceIia avatar Jun 06 '23 14:06 ceIia

Quite interesting that this happens as @esm-bundle/chai is a dependency of @open-wc/testing and not one of @open-wc/testing-helpers. Would you be able to share a more complete repro?

Westbrook avatar Jun 06 '23 16:06 Westbrook

I am also experiencing issues with this in yarn/vitest. Doesn't matter the version i specify, it seems like the latest is affected (4.0.0). Not sure what i need to do to fix this.

quincarter avatar Nov 20 '23 19:11 quincarter

Having same problem with vitest and yarn v4

The problem is @open-wc/testing depends on "@esm-bundle/chai": "^4.3.4-fix.0",

When using yarn "^4.3.4-fix.0" resolves to "4.3.4" (the broken release) and not to "4.3.4-fix.0"

I tried to add a specific version dependency to my project "@esm-bundle/chai": "4.3.4-fix.0" but did not fixed (now i have 2 versions of @esm-bundle/chai)

I added "resolutions": { "@esm-bundle/chai": "4.3.4-fix.0" }

To root package.json and fixed

blikblum avatar Jun 05 '24 00:06 blikblum