Description
Environment
✔ Getting NativeScript components versions information...
✔ Component nativescript has 5.4.0-2019-03-21-13075 version and is up to date.
✔ Component tns-core-modules has 5.3.0 version and is up to date.
✔ Component tns-android has 5.3.0 version and is up to date.
✔ Component tns-ios has 5.3.0 version and is up to date.
Describe the bug
Webpack test bundle does not include 3rd party libraries. We're trying to unit test some of our library code that uses the @microstates/union
. This works when the app is built, but when we try to run the unit tests, they fail with the error:
TypeError: undefined is not an object (evaluating 'modules[moduleId].call')
Which indicates that the microstate library is not bundled at all. Manually inspecting the built vendor.js
, and bundle.js
confirms that this is the case.
To Reproduce
- import a 3rd party library from within a unit test case. You don't even have to try and use it, just log it to the console.
- run
yarn test ios --bundle
Expected behavior
- it resolves the module and dependencies from the
node_modules
directory and includes it in your application'svendor.js
bundle. - in this case, it should have the
microstates
and@microstates/union
modules since they are being imported by our bluetooth library.
Sample project
- Use the
cl/blueteeth
branch from this application https://github.com/resideo-platform/exemplar/tree/cl/blueteeth - Here is the build output for the test target https://gist.github.com/cowboyd/fb05257a428b508c0f0e5cfd928f59f3