This repository was archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Test files are always included in the built application #1041
Copy link
Copy link
Closed
Labels
Milestone
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 6.1.0
- Cross-platform modules: 6.1.0
- Android Runtime: 6.1.0
- iOS Runtime: 6.1.0
- Plugin(s):
{
"nativescript": {
"id": "org.nativescript.app1",
"tns-android": {
"version": "6.1.0"
},
"tns-ios": {
"version": "6.1.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"nativescript-theme-core": "~1.0.6",
"nativescript-unit-test-runner": "^0.7.0",
"tns-core-modules": "~6.1.0"
},
"devDependencies": {
"chai": "4.2.0",
"karma": "4.3.0",
"karma-chai": "0.1.0",
"karma-mocha": "1.3.0",
"karma-nativescript-launcher": "0.4.0",
"karma-webpack": "3.0.5",
"mocha": "6.2.0",
"nativescript-dev-webpack": "~1.2.0"
},
"gitHead": "9475c272a4c74ea6baf24d578bdf46c23a400fea",
"readme": "NativeScript Application"
}
- Node.js: 10.15.3
Describe the bug
Files with unit tests (located in <project dir>/<app dir>/test are always included in the built application, no matter if tns run or tns test is executed. This increases the size of application as there might be a lot of dev dependencies included in the unit test (for example chai).
To Reproduce
- Create a new app:
tns create app1 --js - Navigate to it:
cd app1 - Initialize tests, for example with
mochaframework:tns test init --framework mocha - Open the generate example.js file and add the following line at the top:
const chai = require("chai");(NOTE: This step is just to show that chai will be included in the built application, you can verify only example.js in step 6) - Run
tns prepare android- this should not include any test files in thebundle.js - Check the generated
bundle.jsandvendor.jsin the platforms directory:
- check the
bundle.js- it shouldn't contain any reference toexample.jsfile - in fact it has it - check the
vendor.js- it shouldn't contain any reference tochai- in fact it has it.
Expected behavior
Unit test files and testing dependencies should be included only when tns test <platform> command is executed.
Additional context
This is working correctly in versions prior to 6.0.0.
Reactions are currently unavailable