Skip to content

Commit a54ba74

Browse files
committed
fix: pass appPath to the env from karma.conf.js
Two different webpack compilations are started on `tns test` command - the one from `karma-webpack` and the second one from `nativescript-dev-webpack`. As the karma's webpack doesn't provide appPath to the env and there is a hardcoded `appPath` inside `webpack.config.js` (to `src` for example), it works only with that hardcoded path. Rel to: #5070
1 parent 72a4cd5 commit a54ba74

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/services/test-execution-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { RunController } from "../controllers/run-controller";
66
interface IKarmaConfigOptions {
77
debugBrk: boolean;
88
debugTransport: boolean;
9+
appPath: string;
910
}
1011

1112
export class TestExecutionService implements ITestExecutionService {
@@ -156,6 +157,7 @@ export class TestExecutionService implements ITestExecutionService {
156157
karmaConfig.projectDir = projectData.projectDir;
157158
karmaConfig.bundle = true;
158159
karmaConfig.debugBrk = this.$options.debugBrk;
160+
karmaConfig.appPath = projectData.getAppDirectoryRelativePath();
159161
karmaConfig.platform = platform.toLowerCase();
160162
this.$logger.debug(JSON.stringify(karmaConfig, null, 4));
161163

resources/test/karma.conf.js

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function setWebpack(config, options) {
9999
const env = {};
100100
env[config.platform] = true;
101101
env.sourceMap = config.debugBrk;
102+
env.appPath = config.appPath;
102103
options.webpack = require('./webpack.config')(env);
103104
delete options.webpack.entry;
104105
delete options.webpack.output.libraryTarget;

0 commit comments

Comments
 (0)