Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dist/quasar.esm.prod.js breaks unit tests (webpack + jest) #17184

Open
antonio-masotti opened this issue May 11, 2024 · 0 comments
Open
Assignees
Labels
area/app-ext area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@antonio-masotti
Copy link

antonio-masotti commented May 11, 2024

What happened?

Actually very similar to #14391
The latest version of "@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-beta.7" relies on the existence of quasar/dist/quasar.esm.prod.js, as referenced in @quasar/quasar-app-extension-testing-unit-jest/jest-preset.mjs(in the moduleNameMapper).

Without it all tests that use installQuasarPlugin fail with this message:

   Configuration error:
    
    Could not locate module quasar mapped as:
    quasar/dist/quasar.esm.prod.js.
    
    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/^quasar$/": "quasar/dist/quasar.esm.prod.js"
      },
      "resolver": undefined
    }

but the file is not available anymore in quasar/dist:

❯ ls -al node_modules/quasar/dist/
total 5083
drwxr-xr-x  1  staff  staff       21  May  11  13:09  ./                          
drwxrwxr-x  1  staff  staff        8  May  11  13:09  ../                         
drwxr-xr-x  1  staff  staff      152  May  11  13:09  api/                        
drwxr-xr-x  1  staff  staff       39  May  11  13:09  icon-set/                   
drwxr-xr-x  1  staff  staff       68  May  11  13:09  lang/                       
-rw-r--r--  1  staff  staff    95056  May  11  13:09  quasar.addon.css            
-rw-r--r--  1  staff  staff    67064  May  11  13:09  quasar.addon.prod.css       
-rw-r--r--  1  staff  staff   146802  May  11  13:09  quasar.addon.rtl.css        
-rw-r--r--  1  staff  staff   104244  May  11  13:09  quasar.addon.rtl.prod.css   
-rw-r--r--  1  staff  staff  1039239  May  11  13:09  quasar.client.js            
-rw-r--r--  1  staff  staff   249641  May  11  13:09  quasar.css                  
-rw-r--r--  1  staff  staff   204577  May  11  13:09  quasar.prod.css             
-rw-r--r--  1  staff  staff   301074  May  11  13:09  quasar.rtl.css              
-rw-r--r--  1  staff  staff   246490  May  11  13:09  quasar.rtl.prod.css         
-rw-r--r--  1  staff  staff   211479  May  11  13:09  quasar.sass                 
-rw-r--r--  1  staff  staff   488588  May  11  13:09  quasar.server.prod.cjs      
-rw-r--r--  1  staff  staff   472887  May  11  13:09  quasar.server.prod.js       
-rw-r--r--  1  staff  staff  1077501  May  11  13:09  quasar.umd.js               
-rw-r--r--  1  staff  staff   499059  May  11  13:09  quasar.umd.prod.js          
drwxr-xr-x  1  staff  staff        4  May  11  13:09  transforms/                 
drwxr-xr-x  1  staff  staff       18  May  11  13:09  types/                      
drwxr-xr-x  1  staff  staff        2  May  11  13:09  vetur/                      
drwxr-xr-x  1  staff  staff        1  May  11  13:09  web-types/     

Used packages:

  • `"quasar": "2.16.2"´
  • "@quasar/app-webpack": "^4.0.0-beta.15"
  • "@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-beta.7"

P.s: I first opened an Issue in quasar-testing, but I suppose this repository is a better place for this issue.

What did you expect to happen?

to be able to run the unit tests

Reproduction URL

https://stackblitz.com/edit/quasarframework-webpack-onarqw

How to reproduce?

  1. Install a fresh quasar app with these versions of the relevant packages (or see StackBlitz link):
  • `"quasar": "2.16.2"´
  • "@quasar/app-webpack": "^4.0.0-beta.15"
  • "@quasar/quasar-app-extension-testing-unit-jest": "^3.0.0-beta.7"
  1. npm i
  2. App runs without problems (npm run dev)
  3. but Unit tests fail npm run test:unit

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), App Extension API

Platforms/Browsers

No response

Quasar info output

Operating System - Linux(5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36) - linux/x64
NodeJs - 18.18.0

Global packages
  NPM - 10.2.3
  yarn - 1.22.19
  pnpm - 8.15.6
  bun - Not installed
  @quasar/cli - undefined
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.16.2 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-webpack - 4.0.0-beta.15 -- Quasar Framework App CLI with Webpack
  @quasar/extras - 1.13.4 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.31 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.0.14
  pinia - Not installed
  vuex - Not installed
  eslint - 8.57.0 -- An AST-based pattern checker for JavaScript.
  esbuild-wasm - 0.15.18 -- The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.
  typescript - 5.4.5 -- TypeScript is a language for application scale JavaScript development
  @babel/core - 7.24.5 -- Babel compiler core.
  webpack - 5.91.0 -- Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  webpack-dev-server - 5.0.4 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - Not installed
  register-service-worker - Not installed
  electron - Not installed
  electron-packager - Not installed
  @electron/packager - Not installed
  electron-builder - Not installed
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  @quasar/quasar-app-extension-testing-unit-jest - 3.0.0-beta.7 -- A Quasar App Extension for running Jest tests

Networking
  Host - quasarframeworkwebpackonarqw-zydc
  en0 - 192.168.1.104

Relevant log output

FAIL  test/jest/__tests__/MyDialog.spec.js
  ● Test suite failed to run

    Configuration error:
    
    Could not locate module quasar mapped as:
    quasar/dist/quasar.esm.prod.js.
    
    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/^quasar$/": "quasar/dist/quasar.esm.prod.js"
      },
      "resolver": undefined
    }

      1 | import { beforeEach, describe, expect, it } from '@jest/globals';
    > 2 | import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-jest';
        | ^
      3 | import { DOMWrapper, mount } from '@vue/test-utils';
      4 | import MyDialog from './demo/MyDialog';
      5 |

      at createNoMappedModuleFoundError (node_modules/jest-resolve/build/resolver.js:759:17)
      at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/install-quasar-plugin.ts:4:1)
      at Object.<anonymous> (node_modules/@quasar/quasar-app-extension-testing-unit-jest/src/helpers/main.ts:1:1)
      at Object.require (test/jest/__tests__/MyDialog.spec.js:2:1)

Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        4.226 s
Ran all test suites.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app-ext area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

2 participants