From 4477f34a4ef8281fa505880da1314584a2167114 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sun, 28 Nov 2021 04:44:31 -0300 Subject: [PATCH] fix: ignore unit test files in core projects --- nativescript.webpack.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nativescript.webpack.js b/nativescript.webpack.js index e0cc742..a3034dd 100644 --- a/nativescript.webpack.js +++ b/nativescript.webpack.js @@ -25,6 +25,21 @@ module.exports = webpack => { webpack.chainWebpack((config, env) => { if (env.unitTesting) { return setupUnitTestBuild(config, env, webpack); + } else { + config + .plugin("IgnorePlugin|unit_tests") + .use(IgnorePlugin, [{ + checkResource: (resource, context) => { + if (context === webpack.Utils.platform.getEntryDirPath()) { + if (/(^\.\/test|\.spec)\.(ts|js)$/.test(resource)) { + // console.log('ignoring unit test', context, resource); + return true; + } + } + return false; + + } + }]); } }); };