Navigation

    Quasar Framework

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Tags
    3. jest
    Log in to post
    • G

      Unit Testing - How to mock $q.platform.is.[...]?
      Help • jest platform test testing vue-test-utils • • geddy

      2
      0
      Votes
      2
      Posts
      74
      Views

      G

      Fixed my own issue.

      I created a computed property - isDesktop() - that returns “this.$q.platform.is.desktop”. Then within my test file, I dynamically updated the computed property that then allowed me to test the functionality.

      I defined a factory function that is then called in beforeEach().

      const factory = (computed = { }) => {
      return shallowMount(App, {
      computed
      });
      };

      beforeEach(() => {
      wrapper = factory();
      });

      For the test that requires the updated computer property, I then called the factory function and set the computed property value.

      it(‘my amazing test’, () => {
      wrapper = factory({
      isDesktop: () => false
      });

      expect(addYourAssertionHere)
      })

    • C

      Mocking openURL in Jest unit tests?
      Help • jest mock openurl unit test • • ChrisO

      1
      0
      Votes
      1
      Posts
      33
      Views

      No one has replied

    • Jezzta667

      @quasar/testing with Jest does not print location of failed tests (stack trace)
      CLI • jest test • • Jezzta667

      5
      1
      Votes
      5
      Posts
      260
      Views

      Jezzta667

      @nothingismagick You guys are doing such an awesome job addressing all the issues cropping up. I can imagine you’re working your butts off. It’s very much appreciated.

    • Jezzta667

      console.log() not allowed in Jest tests
      CLI • eslint jest test • • Jezzta667

      4
      0
      Votes
      4
      Posts
      2424
      Views

      Jezzta667

      @nothingismagick thank you for your help. I suspect I must have had case-matching turned on during the search for that line of code, so apologies for the silly question.

      I would be happy to forego console.log() and begin using the Chrome debugger but I have been unable to get this to work with Quasar. I have tried the following:

      Add debugger statement to the test code Run the tests using yarn test:unit:debug Navigate to ‘chrome://inspect’ Click on the ‘inspect’ link for Remote Target: jest file:///

      New Chrome window opens with:

      Uncaught Error: Cannot find module '<my-project-folder>\jest'

      A guide to accessing debugging would be a great addition to the Quasar Testing documentation. 🙂

    • Jezzta667

      Unit Test a Quasar Dialog
      Framework • dialog jest qdialog test vue-test-utils • • Jezzta667

      4
      0
      Votes
      4
      Posts
      386
      Views

      G

      could you please tell me how to test the opening and closing of the dialog ?