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

Commit

Permalink
fix: exclude files from tests folder from built application
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Fatme committed Oct 2, 2019
1 parent 488730d commit c61f10e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bundle-config-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const defaultTestFiles = {
"./_app-variables.scss": false, // do not include scss partial files
"./App_Resources/Android/src/main/res/values/colors.xml": false, // do not include App_Resources
"./App_Resources/Android/src/main/AndroidManifest.xml": false, // do not include App_Resources
"./tests/example.js": false, // do not include files from tests folder
"./tests/component1/model1/file1.js": false, // do not include files from tests folder
"./components/tests/example.js": true,
};

const loaderOptionsWithIgnore = {
Expand Down
4 changes: 2 additions & 2 deletions bundle-config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { loader } from "webpack";
import { getOptions } from "loader-utils";
import * as escapeRegExp from "escape-string-regexp";

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

const loader: loader.Loader = function (source, map) {
let {
Expand Down

0 comments on commit c61f10e

Please sign in to comment.