quasarframework / quasar-testing

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

Setting up a fresh project and creating unit-testing + vitest fails #345

Closed apacha closed 1 year ago

apacha commented 1 year ago

I've created a fresh Quasar project and wanted to add testing capabilities to the project with running

quasar ext add @quasar/testing

I've added both unit-testing with vite and e2e testing with cypress. However, when running

quasar test --unit vite

I get the error message that

You tried to run tests with vite, but it is not installed. Please install @quasar/quasar-app-extension-unit-vite with quasar ext add @quasar/testing-unit-vite

but that package can't be installed as suggested by the comment:

alex@laptop quasar-project % quasar ext add @quasar/testing-unit-vite 
 App • Installing "@quasar/testing-unit-vite" Quasar App Extension

 App • Installing @quasar/quasar-app-extension-testing-unit-vite...
 App • [sync] Running "npm install --save-dev @quasar/quasar-app-extension-testing-unit-vite" in /Users/alex/Repositories/foliant2

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@quasar%2fquasar-app-extension-testing-unit-vite - Not found
npm ERR! 404 
npm ERR! 404  '@quasar/quasar-app-extension-testing-unit-vite@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: /Users/alex/.npm/_logs/2023-08-23T09_44_00_269Z-debug-0.log

 App • ⚠️  Command "npm" failed with exit code: 1

 App • ⚠️   FAIL  Failed to install @quasar/quasar-app-extension-testing-unit-vite

Software version

OS: MacOS Node: 20.5.0 NPM: 9.8.0

What did you get as the error?

'@quasar/quasar-app-extension-testing-unit-vite@*' is not in this registry.

What were you expecting?

A project that has unit-testing and e2e-testing correctly set up, such that I can start a new project.

Question regarding testing of Quasar apps

Is unit-testing something that Quasar supports? I mean I'm using Vite and Jest+Webpack is not an option. Vite+Vitest has been in Alpha for 2 years.

What is the recommended way of writing unit-tests with Quasar? Links to other up-to-date resources would be highly appreciated.

IlCallo commented 1 year ago

You're using the wrong name, you should use quasar test --unit vitest Vite is the bundler, not the test runner Also, please re-install the testing AE and Vitest AE, I just published a fix since it was fetching v0.1 instead of v0.3 of Vitest AE

IlCallo commented 1 year ago

About the "alpha" state of Vitest AE: we're just following Vitest own status Vitest is currently in v0.x status, which is usually referenced as alpha, so we're in alpha too

As soon as Vitest v1 is released, our Vitest AE will be released as stable too