当我尝试使用黄瓜运行量角器测试时,出现以下错误消息“E/launcher - Process exited with error code 1" [英] When I try to run protractor test with cucumber the following error message appears "E/launcher - Process exited with error code 1"

查看:64
本文介绍了当我尝试使用黄瓜运行量角器测试时,出现以下错误消息“E/launcher - Process exited with error code 1"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?我不知道是什么问题.

Can somebody help me? I cannot figure out what is the problem.

Package.json

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

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 命令时,我看到以下内容:

When I run protractor conf.js --troubleshoot command I see the following:

[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

有些文字是因为我无法发布.有些文字是因为我无法发布.有些文字是因为我无法发布.有些文字是因为我无法发布.有些文字是因为我不能发布发布它.有些文字是因为我无法发布.有些文字是因为我无法发布.

Some text because I can't post it.Some text because I can't post it.Some text because I can't post it.Some text because I can't post it.Some text because I can't post it.Some text because I can't post it.Some text because I can't post it.

更新

我从cucumberOpts 中删除了编译器和标签选项,但我面临另一个问题.

I deleted compiler and tags option from cucumberOpts but I facing with another issue.

现在是错误信息:

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,
    'browserName' => 'chrome',
    'browserVersion' => '89.0.4389.114',
    'chrome' => {
      chromedriverVersion: '89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})',
      userDataDir: '/var/folders/jb/2tfthlsj7tgdn_ws0xqhpq_r0000gn/T/.com.google.Chrome.bELobV'
    },
    'goog:chromeOptions' => { debuggerAddress: 'localhost:60608' },
    'networkConnectionEnabled' => false,
    'pageLoadStrategy' => 'normal',
    'platformName' => 'mac os x',
    'proxy' => {},
    'setWindowRect' => true,
    'strictFileInteractability' => false,
    'timeouts' => { implicit: 0, pageLoad: 300000, script: 30000 },
    'unhandledPromptBehavior' => 'dismiss and notify',
    'webauthn:extension:largeBlob' => true,
    '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 并理解为什么它不应该在那里

Find where you use word compiler and understand why it shouldn't be there

例如尝试使用

 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,
      },

这篇关于当我尝试使用黄瓜运行量角器测试时,出现以下错误消息“E/launcher - Process exited with error code 1"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆