如何解决当我尝试使用黄瓜运行量角器测试时,出现以下错误消息“E/launcher - 进程退出,错误代码为 1”
有人可以帮我吗?我不知道是什么问题。
Package.json
{
"devDependencies": {
"@cucumber/cucumber": "^7.0.0","@serenity-js/core": "^2.25.7","@serenity-js/cucumber": "^2.25.7","@serenity-js/protractor": "^2.25.7","@types/jasmine": "^3.6.9","@types/node": "^14.14.37","cucumber-html-reporter": "^5.3.0","jasmine": "^3.7.0","protractor-cucumber-framework": "^8.0.1","ts-node": "^9.1.1","typescript": "^4.2.3"
}
}
tsconfig.json
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true,/* Enable incremental compilation */
"target": "es6",/* Specify ECMAScript target version: 'ES3' (default),'ES5','ES2015','ES2016','ES2017','ES2018','ES2019','ES2020',or 'ESNEXT'. */
"module": "commonjs",/* Specify module code generation: 'none','commonjs','amd','system','umd','es2015','ES2020',or 'ESNext'. */
// "lib": [],/* Specify library files to be included in the compilation. */
// "allowJs": true,/* Allow javascript files to be compiled. */
// "checkJs": true,/* Report errors in .js files. */
// "jsx": "preserve",/* Specify JSX code generation: 'preserve','react-native','react','react-jsx' or 'react-jsxdev'. */
// "declaration": true,/* Generates corresponding '.d.ts' file. */
// "declarationMap": true,/* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true,/* Generates corresponding '.map' file. */
// "outFile": "./",/* Concatenate and emit output to single file. */
"outDir": "./build",/* Redirect output structure to the directory. */
// "rootDir": "./",/* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true,/* Enable project compilation */
// "tsBuildInfoFile": "./",/* Specify file to store incremental compilation information */
// "removeComments": true,/* Do not emit comments to output. */
// "noEmit": true,/* Do not emit outputs. */
// "importHelpers": true,/* Import emit helpers from 'tslib'. */
// "downlevelIteration": true,/* Provide full support for iterables in 'for-of',spread,and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true,/* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true,/* Enable all strict type-checking options. */
// "noImplicitAny": true,/* Raise error on expressions and declarations with an implied 'any' type. */
// "strictnullchecks": true,/* Enable strict null checks. */
// "strictFunctionTypes": true,/* Enable strict checking of function types. */
// "strictBindCallApply": true,/* Enable strict 'bind','call',and 'apply' methods on functions. */
// "strictPropertyInitialization": true,/* Enable strict checking of property initialization in classes. */
"noImplicitThis": false,/* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysstrict": true,/* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true,/* Report errors on unused locals. */
// "noUnusedParameters": true,/* Report errors on unused parameters. */
// "noImplicitReturns": true,/* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true,/* Report errors for fallthrough cases in switch statement. */
// "noUncheckedindexedAccess": true,/* Include 'undefined' in index signature results */
// "nopropertyAccessFromIndexSignature": true,/* Require undeclared properties from index signatures to use element accesses. */
/* Module Resolution Options */
"moduleResolution": "node",/* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./",/* Base directory to resolve non-absolute module names. */
// "paths": {},/* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [],/* List of root folders whose combined content represents the structure of the project at runtime. */
//"typeRoots": ["./node_modules/@types"],/* List of folders to include type deFinitions from. */
//"types": ["node","@cucumber/cucumber"],/* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true,/* Allow default imports from modules with no default export. This does not affect code emit,just typechecking. */
"esModuleInterop": true,/* Enables emit interoperability between Commonjs and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true,/* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true,/* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "",/* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "",/* Specify the location where debugger should locate map files instead of generated locations. */
// "inlinesourceMap": true,/* Emit a single file with source maps instead of having a separate file. */
// "inlinesources": true,/* Emit the source alongside the sourcemaps within a single file; requires '--inlinesourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true,/* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true,/* Enables experimental support for emitting type Metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true,/* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* disallow inconsistently-cased references to the same file. */
},"exclude": [
"node_modules","typescript"
]
}
量角器配置文件
import { Config,browser } from 'protractor';
export let config: Config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',directConnect: true,getPageTimeout: 60000,allScriptsTimeout: 500000,framework: 'custom',ignoreUncaughtExceptions: true,// path relative to the current config file
frameworkPath: require.resolve('protractor-cucumber-framework'),capabilities: {
browserName: 'chrome'
},// Spec patterns are relative to this directory.
specs: [
'features/feature_files/Calculator.feature'
],cucumberOpts: {
compiler: "ts:ts-node/register",require: [
'build/features/util/hook.js','build/features/stepDeFinition/CalculatorDeFinition.js'],format: 'json:./cucumberReports/cucumber_report.json',tags: false,},onPrepare: () => {
browser.driver.manage().window().maximize();
}
};
当我运行 protractor conf.js --troubleshoot 命令时,我看到以下内容:
[11:28:05] D/launcher - Running with --troubleshoot
[11:28:05] D/launcher - Protractor version: 7.0.0
[11:28:05] D/launcher - Your base url for tests is undefined
[11:28:05] I/launcher - Running 1 instances of WebDriver
[11:28:05] I/direct - Using ChromeDriver directly...
[11:28:07] D/runner - WebDriver session successfully started with capabilities Capabilities {
map_: Map(30) {
'acceptInsecureCerts' => false,'acceptSslCerts' => false,'applicationCacheEnabled' => false,'browserConnectionEnabled' => false,'browserName' => 'chrome','chrome' => {
chromedriverVersion: '89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})',userDataDir: '/var/folders/jb/2tfthlsj7tgdn_ws0xqhpq_r0000gn/T/.com.google.Chrome.SBHhc6'
},'cssSelectorsEnabled' => true,'databaseEnabled' => false,'goog:chromeOptions' => { debuggerAddress: 'localhost:51885' },'handlesAlerts' => true,'hasTouchScreen' => false,'javascriptEnabled' => true,'locationContextEnabled' => true,'mobileEmulationEnabled' => false,'nativeEvents' => true,'networkConnectionEnabled' => false,'pageLoadStrategy' => 'normal','platform' => 'Mac OS X','proxy' => {},'rotatable' => false,'setwindowRect' => true,'strictFileInteractability' => false,'takesHeapSnapshot' => true,'takesScreenshot' => true,'timeouts' => { implicit: 0,pageLoad: 300000,script: 30000 },'unexpecteDalertBehavIoUr' => 'ignore','version' => '89.0.4389.90','webStorageEnabled' => true,'webauthn:extension:largeBlob' => true,'webauthn:virtualAuthenticators' => true
}
}
[11:28:07] D/runner - Running with spec files /Users/lamolir/workspace/protractor cucumber/ui-automation/automata/build/features/feature_files/Calculator.feature
error: unkNown option '--compiler'
[11:28:08] E/launcher - Process exited with error code 1
有些文字是因为我无法发布。有些文字是因为我无法发布。有些文字是因为我无法发布。有些文字是因为我无法发布。有些文字是因为我不能发布发布它。有些文字是因为我无法发布。有些文字是因为我无法发布。
更新
我从cucumberOpts 中删除了编译器和标签选项,但我面临另一个问题。
现在是错误信息:
automata % npx protractor build/conf.js --troubleshoot
[13:53:11] D/launcher - Running with --troubleshoot
[13:53:11] D/launcher - Protractor version: 7.0.0
[13:53:11] D/launcher - Your base url for tests is http://juliemr.github.io/protractor-demo/
[13:53:12] I/launcher - Running 1 instances of WebDriver
[13:53:12] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[13:53:13] D/runner - WebDriver session successfully started with capabilities Capabilities {
map_: Map(16) {
'acceptInsecureCerts' => false,'browserVersion' => '89.0.4389.114',userDataDir: '/var/folders/jb/2tfthlsj7tgdn_ws0xqhpq_r0000gn/T/.com.google.Chrome.bELobV'
},'goog:chromeOptions' => { debuggerAddress: 'localhost:60608' },'platformName' => 'mac os x','unhandledPromptBehavior' => 'dismiss and notify','webauthn:virtualAuthenticators' => true,'webdriver.remote.sessionid' => 'a028ee9504875eec81c805be09af580a'
}
}
[13:53:13] D/runner - Running with spec files /Users/lamolir/workspace/protractor cucumber/ui-automation/automata/build/features/feature_files/Calculator.feature
[13:53:14] E/launcher - BUG: launcher exited with 1 tasks remaining
解决方法
显然是在抱怨 error: unknown option '--compiler'
找出您使用单词 compiler
的地方并理解为什么它不应该出现在那里
例如尝试使用
运行代码 cucumberOpts: {
// compiler: "ts:ts-node/register",<-----------------
require: [
'build/features/util/hook.js','build/features/stepDefinition/CalculatorDefinition.js'],format: 'json:./cucumberReports/cucumber_report.json',tags: false,},
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。