【问题标题】:Protractor Not Showing Stack Trace in Visual Studio Code量角器在 Visual Studio 代码中不显示堆栈跟踪
【发布时间】:2020-08-27 22:07:53
【问题描述】:

我是量角器和 Visual Studio 代码的新手,所以对我来说太简单了。我已经尝试在 stackoverflow 和 google 上寻找解决方案,但没有成功。

基本上,我使用终端命令通过 Visual Studio 代码中的量角器运行 e2e 测试,例如'npm run e2e:local' 运行 'export ENVIRONMENT=local && protractor ./e2e/protractor.conf.js

测试运行良好,除了在失败时没有任何类型的堆栈跟踪,所以我不知道如何/在哪里查找我的代码中的错误。 以下是测试运行的示例输出:

[16:55:47] I/direct - Using ChromeDriver directly...
Jasmine started

  Construction NZ Level 50 user
    ✗ Can create a project with all fields filled in and with a contractor
      - Failed: Invalid locator

**************************************************
*                    Failures                    *
**************************************************

1) Construction NZ Level 50 user Can create a project with all fields filled in and with a contractor
  - Failed: Invalid locator

Executed 1 of 3 specs (1 FAILED) (2 SKIPPED) in 31 secs.
[16:56:22] I/launcher - 0 instance(s) of WebDriver still running
[16:56:22] I/launcher - chromeANY #01 failed 1 test(s)
[16:56:22] I/launcher - overall: 1 failed spec(s)
[16:56:22] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! HazardCoHub@1.3.10 e2e:local: `export ENVIRONMENT=local && protractor ./e2e/protractor.conf.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the HazardCoHub@1.3.10 e2e:local script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dmitrikoudrin/.npm/_logs/2020-08-27T04_56_22_187Z-debug.log```

So as you can see it just says "Failed: Invalid locator" which is of no help to me as it could be any one of a 100 locators in the code.
All I want is for it give a standard stack trace and point me to the function that's failing. It would be even better if it could print what locator it tried to find/use before failing.


Full log:
0 info it worked if it ends with ok
1 verbose cli [ '/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin/node',
1 verbose cli   '/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin/npm',
1 verbose cli   'run',
1 verbose cli   'e2e:local' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose run-script [ 'pree2e:local', 'e2e:local', 'poste2e:local' ]
5 info lifecycle HazardCoHub@1.3.11~pree2e:local: HazardCoHub@1.3.11
6 info lifecycle HazardCoHub@1.3.11~e2e:local: HazardCoHub@1.3.11
7 verbose lifecycle HazardCoHub@1.3.11~e2e:local: unsafe-perm in lifecycle true
8 verbose lifecycle HazardCoHub@1.3.11~e2e:local: PATH: /Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/dmitrikoudrin/hazardco_hub_2/node_modules/.bin:/Users/dmitrikoudrin/Library/Android/sdk/tools:/Users/dmitrikoudrin/Library/Android/sdk/build-tools:/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/dmitrikoudrin/Library/Android/sdk/tools:/Users/dmitrikoudrin/Library/Android/sdk/build-tools:/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin
9 verbose lifecycle HazardCoHub@1.3.11~e2e:local: CWD: /Users/dmitrikoudrin/hazardco_hub_2
10 silly lifecycle HazardCoHub@1.3.11~e2e:local: Args: [ '-c',
10 silly lifecycle   'export ENVIRONMENT=local && protractor ./e2e/protractor.conf.js' ]
11 silly lifecycle HazardCoHub@1.3.11~e2e:local: Returned: code: 1  signal: null
12 info lifecycle HazardCoHub@1.3.11~e2e:local: Failed to exec e2e:local script
13 verbose stack Error: HazardCoHub@1.3.11 e2e:local: `export ENVIRONMENT=local && protractor ./e2e/protractor.conf.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid HazardCoHub@1.3.11
15 verbose cwd /Users/dmitrikoudrin/hazardco_hub_2
16 verbose Darwin 19.6.0
17 verbose argv "/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin/node" "/Users/dmitrikoudrin/.nvm/versions/node/v10.16.3/bin/npm" "run" "e2e:local"
18 verbose node v10.16.3
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error HazardCoHub@1.3.11 e2e:local: `export ENVIRONMENT=local && protractor ./e2e/protractor.conf.js`
22 error Exit status 1
23 error Failed at the HazardCoHub@1.3.11 e2e:local script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

【问题讨论】:

  • 欢迎来到stackoverflow。您还可以按照 /Users/dmitrikoudrin/.npm/_logs/2020-08-27T04_56_22_187Z-debug.log 中提供的方式发布完整运行的内容吗?
  • 不,它没有,因为我已经有了@Sergey
  • @AwSnap 已将其添加到帖子中。

标签: node.js npm visual-studio-code jasmine protractor


【解决方案1】:

确保你的配置有

    jasmineNodeOpts: {

        // If true, display spec names.
        isVerbose: true,

        // If true, print colors to the terminal.
        showColors: true,

        // If true, include stack traces in failures.
        includeStackTrace: true,

    },

【讨论】:

  • 请问您说的是哪个配置?因为配置文件很多……有protractor.conf.js,有tsconfig.json,有protractor.conf-dev.js,有config-local.json,有launch.json等等。跨度>
  • 查找jasmineNodeOpts在量角器中的指定位置
猜你喜欢
  • 1970-01-01
  • 2016-03-07
  • 2011-10-06
  • 1970-01-01
  • 2016-09-24
  • 2023-03-09
  • 1970-01-01
  • 1970-01-01
  • 2011-08-07
相关资源
最近更新 更多