Skip to content

cannot run pnpm run test:unit #7281

@srsudar

Description

@srsudar

Affected Packages

repo

Version(s)

head

Bug Description

pnpm run test:unit fails.

If I run pnpm run test:unit, I get the following error. I can fix it by putting "type": "module", in package.json, but that breaks lint and I wouldn't think should be necessary.

$ pnpm run test:unit
> tiptap@ test:unit <snip>/tiptap
> vitest run
failed to load config from <snip>/tiptap/vitest.config.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error [ERR_REQUIRE_ESM]: require() of ES Module <snip>/tiptap/node_modules/.pnpm/vite@7.2.1_@types+node@22.10.3_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vite/dist/node/index.js from <snip>/tiptap/node_modules/.pnpm/vitest@4.0.7_@types+node@22.10.3_@vitest+ui@4.0.7_happy-dom@20.0.2_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/config.cjs not supported.
Instead change the require of index.js in <snip>/tiptap/node_modules/.pnpm/vitest@4.0.7_@types+node@22.10.3_@vitest+ui@4.0.7_happy-dom@20.0.2_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/config.cjs to a dynamic import() which is available in all CommonJS modules.
    at _require.extensions.<computed> [as .js] (file://<snip>/tiptap/node_modules/.pnpm/vite@7.2.1_@types+node@22.10.3_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vite/dist/node/chunks/config.js:36525:9)
    at Object.<anonymous> (<snip>/tiptap/node_modules/.pnpm/vitest@4.0.7_@types+node@22.10.3_@vitest+ui@4.0.7_happy-dom@20.0.2_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/config.cjs:5:12)
    at _require.extensions.<computed> [as .js] (file://<snip>/tiptap/node_modules/.pnpm/vite@7.2.1_@types+node@22.10.3_jiti@2.4.2_sass@1.83.4_terser@5.37.0_yaml@2.7.0/node_modules/vite/dist/node/chunks/config.js:36525:9) {
  code: 'ERR_REQUIRE_ESM'
}

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

I should be able to run unit tests with pnpm run test:unit...I think?

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Open SourceThe issue or pull reuqest is related to the open source packages of Tiptap.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions