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

fix(jest): fix path to stub.css #313

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

mariovor
Copy link

@mariovor mariovor commented Dec 9, 2022

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • New test runner
  • Documentation
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

If you are adding a new test runner, have you...? (check all)

  • Created an issue first?
  • Registered it in /packages/base/runners.json?
  • Added it to /README.md?
  • Included one test that runs baseline.spec.vue?
  • Added and updated documentation?
  • Included a recipe folder with properly building quasar project?

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the dev branch and not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on Windows
  • It's been tested on Linux
  • It's been tested on MacOS
  • Any necessary documentation has been added or updated in the docs (for faster update click on "Suggest an edit on GitHub" at bottom of page) or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
I encountered an error

 Configuration error:
    
    Could not locate module src/css/table_styles.css mapped as:
    @quasar/quasar-app-extension-testing-unit-jest/stub.css.
    
    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/.*css$/": "@quasar/quasar-app-extension-testing-unit-jest/stub.css"
      },
      "resolver": undefined
    }

      1 | import { ColDef } from 'ag-grid-enterprise';
    > 2 | import 'src/css/table_styles.css';
        | ^

which is fixed on my site with the change of path to the stub.css.

@IlCallo
Copy link
Member

IlCallo commented Dec 9, 2022

Not sure what's happening in your case, but stub.css is copied over to the dist folder when running build script, so the current mapping is already correct and AFAIK it works on a newly generated project

Have you tried reinstalling your dependencies?
Could you check node_modules/@quasar/quasar-app-extensions-testing-unit-jest/dist and let me know if you see stub.css inside it?

@mariovor
Copy link
Author

mariovor commented Dec 9, 2022

I see stub.css in the dist folder. No idea why I get this error.

@IlCallo
Copy link
Member

IlCallo commented Dec 9, 2022

Can you reproduce this into a clean project?

@mariovor
Copy link
Author

mariovor commented Dec 9, 2022

I created a new project, added a css file and import it in the MyButton.vue demo file

grafik

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

    Configuration error:
    
    Could not locate module ./css/table_styles.css mapped as:
    @quasar/quasar-app-extension-testing-unit-jest/stub.css.
    
    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/.*css$/": "@quasar/quasar-app-extension-testing-unit-jest/stub.css"
      },
      "resolver": undefined
    }

      1 | <script>
      2 | import { defineComponent, ref } from 'vue';
    > 3 | import './css/table_styles.css'
        | ^
      4 |
      5 | export default defineComponent({
      6 |   name: 'MyButton',

      at createNoMappedModuleFoundError (node_modules/jest-resolve/build/resolver.js:752:17)
      at Object.<anonymous> (test/jest/__tests__/demo/MyButton.vue:3:1)
      at Object.<anonymous> (test/jest/__tests__/MyButton.spec.js:5:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants