sniperadmin / vue-commerce

My first E-Commerce app with [Firebase - Stripe payment and more]
https://vue-shop-e3547.firebaseapp.com
MIT License
8 stars 3 forks source link

Jest support error #19

Open sniperadmin opened 4 years ago

sniperadmin commented 4 years ago

Jest has unexpected behaviors:

first, this error pops up:

PS C:\Users\Nasr\Desktop\vue-commerce> jest
 FAIL  tests/unit/example.spec.js
  ● Test suite failed to run

    not supported

      at Root.loadSync (node_modules/protobufjs/src/root.js:234:15)
      at Object.loadSync (node_modules/protobufjs/src/index-light.js:69:17)
      at Object.<anonymous> (node_modules/@grpc/proto-loader/build/src/index.js:235:37)
      at Object.<anonymous> (node_modules/@firebase/firestore/dist/index.node.cjs.js:14:19)

[vue-jest]: no tsconfig.json found, defaulting to default typescript options

seond: the project does not use TS by any means.

here are the basic configs

babel.config.js

module.exports = {
  presets: ['@vue/app'],
  env: {
    test: {
      plugins: ['require-context-hook']
    }
  }
}
emmanuelthegrey commented 4 years ago

I was having this problem too. I realized I was importing another helper class that also referenced a firebase library. Make sure you have mocked out every method that is calling a firebase method and if you are calling them directly then mock those out as well.

sniperadmin commented 4 years ago

Cool @emmanuelthegrey , now i have resolved some config errors. If you could give assistance with the following issues, i will be grateful: