Here’s the situation:
- The purpose is to write a service
- in this service, a 3rd party library was introduced (device.js)
- I use ember-cli-node-assets to add this tiny lib into vendor tree
- I use
app.import
to import this tiny lib, alsoapp.import
a shims to wrap this lib into ES2015 module -
import
this shimming module in this service - now tests running in browser are fine
- tests running in local CLI (macOS w/ phantomjs) are fine too (I was thought it will fails too! surprise)
- tests running in CI (jenkins on ubuntu 16.04 w/ same version of node & yarn & phantomjs) are failed when tests cover the part involved with the 3rd party module
I known this 3rd-party lib is depends on document
and user agent, but I think phantomjs can handle that for me, I’m also try to access global window.device
successfully, the real problem is tests failed because of:
undefined is not a function (evaluating '_device.default.mobile()')
anyone knows how to actually import (or even mock this module) under this situation?