quasarframework / quasar-testing

Testing Harness App Extensions for the Quasar Framework 2.0+
https://testing.quasar.dev
MIT License
180 stars 65 forks source link

Warning when I run `quasar dev` #380

Closed chiaraani closed 2 weeks ago

chiaraani commented 1 month ago

When I run this command I get these logs with a warning about quasar-app-extension-testing-unit-vitest that I should contact the author of the package:

> quasar dev -m ssr

 .d88888b.
d88P" "Y88b
888     888
888     888 888  888  8888b.  .d8888b   8888b.  888d888
888     888 888  888     "88b 88K          "88b 888P"
888 Y8b 888 888  888 .d888888 "Y8888b. .d888888 888
Y88b.Y8b88P Y88b 888 888  888      X88 888  888 888
 "Y888888"   "Y88888 "Y888888  88888P' "Y888888 888
       Y8b

 App • Running "@quasar/testing-unit-vitest" Quasar App Extension...
 App •  WAIT  • Compiling of SSR Webserver with Esbuild in progress...
 App •  DONE  • SSR Webserver compiled with success • 57ms

 App •  WAIT  • Warming up...
@quasar/quasar-app-extension-testing-unit-vitest doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.
[ESLint] Found 0 error and 0 warning
 App •  DONE  • Warmed up • 5743ms

 App •  WAIT  • Starting webserver...
 App •  DONE  • Webserver is ready • 28ms

This is the warning alone:

@quasar/quasar-app-extension-testing-unit-vitest doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

IlCallo commented 1 month ago

Please provide a repro, we cannot reproduce the problem with the info you provided

chiaraani commented 1 month ago

I used both node 20 and 22, and I got the same warning.

This is my package.json:

"scripts": {
    "lint": "eslint --ext .js,.vue ./",
    "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
    "test": "echo \"See package.json => scripts for available tests.\" && exit 0",
    "dev": "quasar dev -m ssr",
    "build": "quasar build -m ssr",
    "test:unit:ui": "vitest --ui",
    "test:unit": "vitest"
  },
  "dependencies": {
    "@quasar/extras": "^1.16.4",
    "axios": "^1.2.1",
    "lodash": "^4.17.21",
    "pinia": "^2.0.11",
    "quasar": "^2.16.0",
    "vue": "^3.4.18",
    "vue-i18n": "^9.0.0",
    "vue-router": "^4.0.12"
  },
  "devDependencies": {
    "@intlify/vite-plugin-vue-i18n": "^3.3.1",
    "@pinia/testing": "^0.1.4",
    "@quasar/app-vite": "^1.9.0",
    "@quasar/quasar-app-extension-testing-unit-vitest": "^1.0.0",
    "@vitest/ui": "^1.3.1",
    "@vue/test-utils": "^2.4.4",
    "autoprefixer": "^10.4.2",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^8.1.0",
    "eslint-plugin-vue": "^9.0.0",
    "postcss": "^8.4.14",
    "prettier": "^2.5.1",
    "vite-plugin-checker": "^0.6.4",
    "vitest": "^1.3.1"
  },
  "engines": {
    "node": "^22 || ^20 || ^18 || ^16",
    "npm": ">= 6.13.4",
    "yarn": ">= 1.21.1"
  }
IlCallo commented 1 month ago

A repro is a repository containing a runnable example which I can study

chiaraani commented 1 month ago

Here I made a reproduction with Code Sand Box: Reproduction of Quasar Vitest warning

IlCallo commented 2 weeks ago

Seems like a problem with Vite 2 and its SSR mode, on which the current @quasar/app-vite is based Probably because Vite 2 doesn't support Node versions which support ESM and CJS natively

The new @quasar/app-vite, currently in beta and using Vite 5, doesn't show this behavior Since it's just a warning and that it will be fixed by next major version, I won't take action on this for now In case this cause some actual issue, I'll get back to this and find a way to fix it It's probably just a matter of adding a double entry point, as we do for Cypress AE, one in CommonJS and one in ESM It shouldn't be needed for Vitest because it only supports Node versions that natively support ESM

Thanks for reporting it anyway, it's important to get this kind of feedback from the community