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.

Cannot run unit tests

See original GitHub issue

I am attempting to use vue-test-utils and jest to run some unit tests on my vuex actions. I am running into the error below. Any ideas on how I can get this resolved?

 FAIL  test/unit/specs/masternode/Provision.spec.js
  ● Test suite failed to run

    TypeError: Cannot read property '_config' of undefined

    
      
      at new VuexPersistence (node_modules/vuex-persist/dist/index.js:133:44)
      at Object.<anonymous> (src/store/index.js:60:17)
      at Object.<anonymous> (src/contracts/MNProposedMarket.js:19:14)
      at Object.<anonymous> (src/store/modules/app/actions.js:35:25)
      at Object.<anonymous> (src/store/modules/app/index.js:7:16)
      at Object.<anonymous> (src/store/modules/index.js:7:12)
      at Object.<anonymous> (test/unit/specs/masternode/Provision.spec.js:27:16)

Here is my spec so far:

describe('AppActions', () => {
  const vuexLocal = new VuexPersist({
    storage: window.localStorage,
    modules: ['app', 'masternode', 'marketplace'],
  })
  let store

  beforeEach(() => {
    store = new VuexStore ({
      plugins: [vuexLocal.plugin]
    })
  })
})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
championswimmercommented, Apr 23, 2018

Sorry I had been really swamped by work. I’ll fix this, this week.

On Mon 23 Apr, 2018, 5:34 PM SkyzohKey, notifications@github.com wrote:

Same issue here, we are using vuex-persist to store some credentials on the sessionStorage for a company internal tool but it seems that it is currently not possible to run tests. Same error as above.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/championswimmer/vuex-persist/issues/41#issuecomment-383551443, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQ_ynZHQjjp964TwYKIglWz4HOYnz-cks5trcNpgaJpZM4S3gc9 .

1reaction
sbancalcommented, Mar 29, 2018

Thanks @championswimmer , I’ve tried v1.1.6 … original error disappeared, but a new one came up :

 FAIL  test/unit/specs/ProjectSwitch.spec.js
  ● Test suite failed to run

    TypeError: Cannot read property 'getItem' of undefined

      23 | }
      24 | 
    > 25 | export default new Vuex.Store({
      26 |   state,
      27 |   mutations,
      28 |   actions,
      
      at VuexPersistence.restoreState (node_modules/vuex-persist/dist/index.js:201:43)
      at VuexPersistence.plugin (node_modules/vuex-persist/dist/index.js:225:40)
      at node_modules/vuex/dist/vuex.common.js:353:46
          at Array.forEach (<anonymous>)
      at new Store (node_modules/vuex/dist/vuex.common.js:353:11)
      at Object.<anonymous> (src/store/index.js:25:1)
      at Object.<anonymous> (test/unit/specs/ProjectSwitch.spec.js:7:14)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests not running in Test Explorer - visual studio
The Test Explorer is showing all unit tests, but once clicking on "Run All", all tests are getting greyed out and show no...
Read more >
Can't run or debug unit tests - Visual Studio Feedback
I'm using Visual Studio Community Edition 15.8.1 and I can't run or debug any unit tests. Every time I'm trying to run the...
Read more >
Cannot run Unit Tests | Apple Developer Forums
1. Open project in Xcode which has unit tests · 2. Open the Test navigator · 3. Click a run button to run...
Read more >
How To Resolve Issue Of Test Project Not Running The Unit ...
Two of my test projects didn't run the test cases, it was about to start and took some time to run the test...
Read more >
Can't run unit test in Test Runner
I am new to the unit test framework in pycharm. I created a simple unit test driver that uses "unittest". However, I can't...
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