当通过babel-register运行mocha测试时,firebase.messaging不是一个函数

时间:2017-02-27 03:15:02

标签: webpack tdd mocha firebase-cloud-messaging babel

跑步:

 "test": "set NODE_PATH=./app&& mocha --require ./test/testSetup.js --compilers babel-core/register \"./app/**/*.test.js\""

输出此错误:

  

var messaging = exports.messaging = firebase.messaging();

     

TypeError:firebase.messaging不是函数

指的是:

import firebase from 'firebase'

export const database = firebase.database()
export const firebaseAuth = firebase.auth()
export const messaging = firebase.messaging()

messaging.onMessage(payload => {
  handleInAppMessages(payload)
})

0 个答案:

没有答案