-
-
Notifications
You must be signed in to change notification settings - Fork 197
Unit tests run with --bundle does not bundle 3rd party libraries #4477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, it doesn't work :( I've just checked it and found that the problem is here https://github.com/NativeScript/nativescript-dev-webpack/blob/master/unit-testing-config-loader.js#L5. I tried to manually change the above mentioned code from
After that I ran
As you can see the bluetooth object is populated now - I've played a little bit more with the code and was able to successfully run the tests with the following modifications: bluetooth.test.ts
bluetooth.ts
|
That's seems to fix it. Don't worry so much about the imports, we were just fooling around with them to see if there was something that we had to change, I changed them back to the way they were, and we can now use the module as expected. In the meantime, we can try to fix it or vendor it. |
* release: cut the 0.21.0 release * fix: add support for ts files on test command when `--bundle` is provided (#848) Rel to: NativeScript/nativescript-cli#4477 NativeScript/nativescript-cli#1798
* release: cut the 0.21.0 release * fix: add support for ts files on test command when `--bundle` is provided (#848) Rel to: NativeScript/nativescript-cli#4477 NativeScript/nativescript-cli#1798 * fix: use correct slashes on windows (#851)
* release: cut the 0.21.0 release * fix: add support for ts files on test command when `--bundle` is provided (#848) Rel to: NativeScript/nativescript-cli#4477 NativeScript/nativescript-cli#1798 * fix: use correct slashes on windows (#851) * fix: fix "ERROR in Must have a source file to refactor." error from ngCompilerPlugin on `test` command (#859)
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:Which indicates that the microstate library is not bundled at all. Manually inspecting the built
vendor.js
, andbundle.js
confirms that this is the case.To Reproduce
yarn test ios --bundle
Expected behavior
node_modules
directory and includes it in your application'svendor.js
bundle.microstates
and@microstates/union
modules since they are being imported by our bluetooth library.Sample project
cl/blueteeth
branch from this application https://github.com/resideo-platform/exemplar/tree/cl/blueteethThe text was updated successfully, but these errors were encountered: