Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit c61f10e

Browse files
committed
fix: exclude files from tests folder from built application
Currently unit tests files and dependencies are always included in the built application regardless if `tns test` or another command is executed. This way the size of built package is increased as all unit test related dependencies are included (such as mocha, chai, angularTestBed and their dependencies as well). Rel to #1041
1 parent 488730d commit c61f10e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: bundle-config-loader.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const defaultTestFiles = {
3939
"./_app-variables.scss": false, // do not include scss partial files
4040
"./App_Resources/Android/src/main/res/values/colors.xml": false, // do not include App_Resources
4141
"./App_Resources/Android/src/main/AndroidManifest.xml": false, // do not include App_Resources
42+
"./tests/example.js": false, // do not include files from tests folder
43+
"./tests/component1/model1/file1.js": false, // do not include files from tests folder
44+
"./components/tests/example.js": true,
4245
};
4346

4447
const loaderOptionsWithIgnore = {

Diff for: bundle-config-loader.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { loader } from "webpack";
33
import { getOptions } from "loader-utils";
44
import * as escapeRegExp from "escape-string-regexp";
55

6-
// Matches all source, markup and style files that are not in App_Resources
7-
const defaultMatch = "(?<!\\bApp_Resources\\b.*)\\.(xml|css|js|(?<!\\.d\\.)ts|(?<!\\b_[\\w-]*\\.)scss)$";
6+
// Matches all source, markup and style files that are not in App_Resources and in tests folder
7+
const defaultMatch = "(?<!\\bApp_Resources\\b.*)(?<!\\.\\/\\btests\\b\\/.*?)\\.(xml|css|js|(?<!\\.d\\.)ts|(?<!\\b_[\\w-]*\\.)scss)$";
88

99
const loader: loader.Loader = function (source, map) {
1010
let {

0 commit comments

Comments
 (0)