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

fix: fix the execution of unit tests with latest unit-test-runner and nativescript-dev-webpack@rc #978

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion unit-testing-config-loader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
const { join, relative } = require("path");
const { existsSync } = require("fs");
const { convertSlashesInPath } = require("./projectHelpers");

function getRunnerFullPath(projectRoot) {
const runnerRootPath = join(projectRoot, "node_modules", "nativescript-unit-test-runner");
const runnerAppPath = join(runnerRootPath, "app");
const result = existsSync(runnerAppPath) ? runnerAppPath : runnerRootPath;

return result;
}

module.exports = function ({ appFullPath, projectRoot, angular, rootPagesRegExp }) {
// TODO: Consider to use the files property from karma.conf.js
const testFilesRegExp = /tests\/.*\.(ts|js)/;
const runnerFullPath = join(projectRoot, "node_modules", "nativescript-unit-test-runner", "app");
const runnerFullPath = getRunnerFullPath(projectRoot);
const runnerRelativePath = convertSlashesInPath(relative(appFullPath, runnerFullPath));
const appCssFilePath = convertSlashesInPath(join(runnerRelativePath, "app.css"));
let source = `
Expand Down