Title: Unit tests run with --bundle does not bundle 3rd party libraries · Issue #4477 · NativeScript/nativescript-cli · GitHub
Open Graph Title: Unit tests run with --bundle does not bundle 3rd party libraries · Issue #4477 · NativeScript/nativescript-cli
X Title: Unit tests run with --bundle does not bundle 3rd party libraries · Issue #4477 · NativeScript/nativescript-cli
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-androi...
Open Graph 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 a...
X 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 a...
Opengraph URL: https://github.com/NativeScript/nativescript-cli/issues/4477
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unit tests run with --bundle does not bundle 3rd party libraries","articleBody":"**Environment**\r\n✔ Getting NativeScript components versions information...\r\n✔ Component nativescript has 5.4.0-2019-03-21-13075 version and is up to date.\r\n✔ Component tns-core-modules has 5.3.0 version and is up to date.\r\n✔ Component tns-android has 5.3.0 version and is up to date.\r\n✔ Component tns-ios has 5.3.0 version and is up to date.\r\n\r\n**Describe the bug**\r\nWebpack 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:\r\n\r\n```\r\nTypeError: undefined is not an object (evaluating 'modules[moduleId].call')\r\n```\r\n\r\nWhich 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.\r\n\r\n\r\n**To Reproduce**\r\n1. 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.\r\n2. run `yarn test ios --bundle`\r\n\r\n**Expected behavior**\r\n1. it resolves the module and dependencies from the `node_modules` directory and includes it in your application's `vendor.js` bundle.\r\n2. in this case, it should have the `microstates` and `@microstates/union` modules since they are being imported by our bluetooth library.\r\n\r\n**Sample project**\r\n- Use the `cl/blueteeth` branch from this application https://github.com/resideo-platform/exemplar/tree/cl/blueteeth\r\n- Here is the build output for the test target https://gist.github.com/cowboyd/fb05257a428b508c0f0e5cfd928f59f3\r\n\r\n","author":{"url":"https://github.com/cowboyd","@type":"Person","name":"cowboyd"},"datePublished":"2019-03-27T19:16:40Z","url":"https://github.com/NativeScript/nativescript-cli/issues/4477"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9552ae9c-5bd5-7cd7-ca76-d8e692fa2eea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FD8:269AD9:2A42E9E:3870247:6B01C045 |
| html-safe-nonce | 67c69fef2dd21d85066faeb5e3a428b9c42c7163263465301437168a316f3175 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkQ4OjI2OUFEOToyQTQyRTlFOjM4NzAyNDc6NkIwMUMwNDUiLCJ2aXNpdG9yX2lkIjoiNjg0NTA3NDMwMTI0NzQwNjE0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f511afe038b00e77fa66730e6019947f2aa9fb3190f4c829aea09bc39dbd7291 |
| hovercard-subject-tag | issue:426139761 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/nativescript-cli/4477/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e3f0d412e367b2e7a4af53a591dfa3d7691ee434cf9fc49e94620971d8b502d/NativeScript/nativescript-cli/issues/4477 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e3f0d412e367b2e7a4af53a591dfa3d7691ee434cf9fc49e94620971d8b502d/NativeScript/nativescript-cli/issues/4477 |
| og:image:alt | 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 a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cowboyd |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/nativescript-cli git https://github.com/NativeScript/nativescript-cli.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 21347346 |
| octolytics-dimension-repository_nwo | NativeScript/nativescript-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21347346 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/nativescript-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width