@cplace/cli
Advanced tools
Comparing version 0.18.2 to 0.19.0
@@ -1,4 +0,1 @@ | ||
/** | ||
* Main E2E command | ||
*/ | ||
import { ICommand, ICommandParameters } from '../models'; | ||
@@ -50,2 +47,3 @@ export declare class E2E implements ICommand { | ||
private findAllPluginsInWorkingDirectory; | ||
private getMainRepoPackageJson; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.E2E = void 0; | ||
const WdioConfigGenerator_1 = require("./WdioConfigGenerator"); | ||
const TestRunner_1 = require("./TestRunner"); | ||
/** | ||
* Main E2E command | ||
*/ | ||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
const path = require("path"); | ||
const Global_1 = require("../../Global"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const util_1 = require("../../util"); | ||
const glob = require("glob"); | ||
const TestRunner_1 = require("./TestRunner"); | ||
const util_2 = require("./util"); | ||
const WdioConfigGenerator_1 = require("./WdioConfigGenerator"); | ||
class E2E { | ||
@@ -16,2 +19,3 @@ constructor() { | ||
} | ||
// tslint:disable-next-line: max-func-body-length | ||
prepareAndMayExecute(params) { | ||
@@ -175,10 +179,4 @@ this.workingDir = process.cwd(); | ||
isAllureReporterInstalled() { | ||
const pathToPackageJson = path.join(this.mainRepoDir, 'package.json'); | ||
// tslint:disable-next-line:no-any | ||
let packageJson; | ||
try { | ||
packageJson = JSON.parse(fs.readFileSync(pathToPackageJson, 'utf8')); | ||
} | ||
catch (e) { | ||
console.error(`Failed to read package.json from: ${pathToPackageJson} - assuming Allure Reporter is not installed`); | ||
const packageJson = this.getMainRepoPackageJson(this.mainRepoDir); | ||
if (!packageJson) { | ||
return false; | ||
@@ -229,2 +227,13 @@ } | ||
} | ||
// tslint:disable-next-line: no-any | ||
getMainRepoPackageJson(mainRepoDir) { | ||
const pathToPackageJson = path.join(mainRepoDir, 'package.json'); | ||
try { | ||
return JSON.parse(fs.readFileSync(pathToPackageJson, 'utf8')); | ||
} | ||
catch (e) { | ||
console.error(`Failed to read package.json from: ${pathToPackageJson} - assuming Allure Reporter is not installed`); | ||
return null; | ||
} | ||
} | ||
} | ||
@@ -231,0 +240,0 @@ exports.E2E = E2E; |
@@ -13,7 +13,7 @@ "use strict"; | ||
exports.TestRunner = void 0; | ||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const util_1 = require("./util"); | ||
const WdioConfigGenerator_1 = require("./WdioConfigGenerator"); | ||
const util_1 = require("./util"); | ||
const glob = require("glob"); | ||
class TestRunner { | ||
@@ -32,8 +32,20 @@ constructor(plugins, workingDir, mainRepoDir, specsParameter) { | ||
if (!this.specsParameter || (this.specsParameter && this.isSpecInPlugin(plugin))) { | ||
const wdioConf = path.join(util_1.getPathToE2E(this.workingDir, plugin), WdioConfigGenerator_1.WdioConfigGenerator.WDIO_CONF_NAME); | ||
const e2eAssetPath = util_1.getPathToE2E(this.workingDir, plugin); | ||
const wdioConf = path.join(e2eAssetPath, WdioConfigGenerator_1.WdioConfigGenerator.WDIO_CONF_NAME); | ||
process.chdir(this.mainRepoDir); | ||
const launcher = new launcherModule.default(wdioConf, { args: [''] }); | ||
const testHasFailed = yield launcher.run(); | ||
if (testHasFailed) { | ||
let testsFailed = false; | ||
try { | ||
const exitCode = yield launcher.run(); | ||
testsFailed = exitCode !== 0; | ||
} | ||
catch (e) { | ||
testsFailed = true; | ||
} | ||
finally { | ||
process.chdir(this.workingDir); | ||
} | ||
if (testsFailed) { | ||
hasFailedTest = true; | ||
console.warn(`One of the E2E Tests in plugin ${plugin} has failed`); | ||
hasFailedTest = true; | ||
} | ||
@@ -40,0 +52,0 @@ } |
import { IE2EContext } from './E2EEnvTemplate'; | ||
export declare class WdioConfigGenerator { | ||
static readonly WDIO_CONF_NAME: string; | ||
static readonly E2E_ENV_NAME: string; | ||
private readonly workingDir; | ||
private readonly mainDir; | ||
private readonly context; | ||
private readonly plugins; | ||
private readonly specs; | ||
private readonly browser; | ||
private readonly context; | ||
private readonly timeout; | ||
@@ -17,2 +15,4 @@ private readonly headless; | ||
private readonly screenshotPath; | ||
static readonly WDIO_CONF_NAME: string; | ||
static readonly E2E_ENV_NAME: string; | ||
constructor(workingDir: string, mainDir: string, plugins: string[], specs: string, browser: string, context: IE2EContext, timeout: number, headless: boolean, noInstall: boolean, jUnitReportPath: string, allureOutputPath: string, screenshotPath: string); | ||
@@ -23,2 +23,3 @@ static safePath(filePath: string): string; | ||
generateWdioConfig(): void; | ||
private getWdioTemplate; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WdioConfigGenerator = void 0; | ||
const ConfigTemplate_1 = require("./ConfigTemplate"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const E2EEnvTemplate_1 = require("./E2EEnvTemplate"); | ||
const WdioConfigTemplate_1 = require("./WdioConfigTemplate"); | ||
class WdioConfigGenerator { | ||
@@ -12,5 +12,5 @@ constructor(workingDir, mainDir, plugins, specs, browser, context, timeout, headless, noInstall, jUnitReportPath, allureOutputPath, screenshotPath) { | ||
this.mainDir = mainDir; | ||
this.browser = browser; | ||
this.plugins = plugins; | ||
this.specs = specs; | ||
this.browser = browser; | ||
this.context = context; | ||
@@ -40,6 +40,9 @@ this.timeout = timeout; | ||
const mainDir = WdioConfigGenerator.safePath(this.mainDir); | ||
const config = new ConfigTemplate_1.ConfigTemplate(mainDir, e2eFolder, this.specs, this.browser, this.context.baseUrl, this.context, this.timeout, this.headless, this.noInstall, this.jUnitReportPath, this.allureOutputPath, this.screenshotPath, this.context.e2eToken); | ||
const config = this.getWdioTemplate(mainDir, e2eFolder); | ||
fs.writeFileSync(path.join(e2eFolder, WdioConfigGenerator.WDIO_CONF_NAME), config.getTemplate(), { encoding: 'utf8' }); | ||
}); | ||
} | ||
getWdioTemplate(mainDir, e2eFolder) { | ||
return new WdioConfigTemplate_1.WdioConfigTemplate(mainDir, e2eFolder, this.specs, this.browser, this.context.baseUrl, this.context, this.timeout, this.headless, this.noInstall, this.jUnitReportPath, this.allureOutputPath, this.screenshotPath, this.context.e2eToken); | ||
} | ||
} | ||
@@ -46,0 +49,0 @@ exports.WdioConfigGenerator = WdioConfigGenerator; |
{ | ||
"name": "@cplace/cli", | ||
"version": "0.18.2", | ||
"version": "0.19.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,1 +1,11 @@ | ||
# Document Control / Repository Information | ||
Item | Value | ||
--- | --- | ||
Owner | Christian Kaltenbach, Philip Stöhrer, Stefan Stadler | ||
Team | none yet | ||
Project | none | ||
Parent | none | ||
Developed by | collaboration Factory AG | ||
Description | Unser Kommandozeilen-Werkzeug um mit cplace Code zu arbeiten. | ||
# cplace CLI tools | ||
@@ -2,0 +12,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
358744
5021
210
2