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

Commit 5423504

Browse files
Fatmedtopuzov
authored andcommitted
fix: fix the execution of unit tests with latest unit-test-runner and nativescript-dev-webpack@rc (#978)
With the latest rc of nativescript-dev-webpack it is not possible to run unit tests as the nativescript-dev-webpack searches for app folder inside runner root folder. As such folder doesn't exist in live version of nativescript-unit-test-runner, test command throws an error.
1 parent dbd8c8d commit 5423504

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: unit-testing-config-loader.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
const { join, relative } = require("path");
2+
const { existsSync } = require("fs");
23
const { convertSlashesInPath } = require("./projectHelpers");
34

5+
function getRunnerFullPath(projectRoot) {
6+
const runnerRootPath = join(projectRoot, "node_modules", "nativescript-unit-test-runner");
7+
const runnerAppPath = join(runnerRootPath, "app");
8+
const result = existsSync(runnerAppPath) ? runnerAppPath : runnerRootPath;
9+
10+
return result;
11+
}
12+
413
module.exports = function ({ appFullPath, projectRoot, angular, rootPagesRegExp }) {
514
// TODO: Consider to use the files property from karma.conf.js
615
const testFilesRegExp = /tests\/.*\.(ts|js)/;
7-
const runnerFullPath = join(projectRoot, "node_modules", "nativescript-unit-test-runner", "app");
16+
const runnerFullPath = getRunnerFullPath(projectRoot);
817
const runnerRelativePath = convertSlashesInPath(relative(appFullPath, runnerFullPath));
918
const appCssFilePath = convertSlashesInPath(join(runnerRelativePath, "app.css"));
1019
let source = `

0 commit comments

Comments
 (0)