question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Documentation][3.0.0-beta.1] Unit testing

See original GitHub issue

Environment

Vuetify Version: 3.0.0-alpha.12 Vue Version: 3.2.13 Browsers: Chrome 98.0.4758.102 OS: Windows 10

Steps to reproduce

git clone https://github.com/governance-foundation/template-electron-vuex-vuetify.git cd template-electron-vuex-vuetify npm install npm run test:unit

Expected Behavior

unit test pass

Actual Behavior

 FAIL  src/components/__tests__/HelloWorld.spec.ts [ src/components/__tests__/HelloWorld.spec.ts ]
ReferenceError: CSS is not defined
 ❯ node_modules/vuetify/lib/util/globals.mjs:7:52
      5| export const SUPPORTS_INTERSECTION = IN_BROWSER && 'IntersectionObserver' in window;
      6| export const SUPPORTS_TOUCH = IN_BROWSER && ('ontouchstart' in window || window.navigator.maxTouchPoints > 0);
      7| export const SUPPORTS_FOCUS_VISIBLE = IN_BROWSER && CSS.supports('selector(:focus-visible)');
       |                                                    ^
      8| //# sourceMappingURL=globals.mjs.map
 ❯ async node_modules/vuetify/lib/util/index.mjs:19:31
 ❯ async node_modules/vuetify/lib/composables/tag.mjs:2:31
 ❯ async node_modules/vuetify/lib/components/VGrid/VContainer.mjs:7:31

Reproduction Link

https://github.com/governance-foundation/template-electron-vuex-vuetify

Other comments

I have globals set, and setup files mocking global.CSS.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:42 (11 by maintainers)

github_iconTop GitHub Comments

14reactions
MaciejJanyskacommented, Nov 22, 2022

Why is this closed if the issue is not resolved? 🤔 Still no documentation on unit testing…

6reactions
mpont91commented, May 17, 2022

I finally managed to pass the tests. The last step is add this on vite.config.js

  test: {
    setupFiles: "vuetify.config.js",
    deps: {
      inline: ["vuetify"],
    },
    globals: true,
  }

And vuetify.config.js has the css support false:

global.CSS = { supports: () => false };

I leave my repo reproducing the problem and the last commit solving it, so it can help someone. https://github.com/mpont91/vue3-vuetify-tests

Read more comments on GitHub >

github_iconTop Results From Across the Web

dockest 3.0.0-beta.1-292b5cc vulnerabilities | Snyk
dockest@3.0.0-beta.1-292b5cc vulnerabilities. Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst ...
Read more >
dockest - npm
Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.
Read more >
Unit testing
In this guide we will see how you can run basic unit tests for a Strapi application using a testing framework. TIP. In...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages....
Read more >
Welcome to istSOS3's documentation
IstSOS is an OGC SOS 2.0 server implementation written in Python. Contents: System Types classification · Point TimeSeries Observation · Mobile TimeSeries ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found