Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap reporter can produce invalid output due to stack trace #1257

Closed
jreichenberg opened this issue Jul 3, 2014 · 2 comments · Fixed by #3552
Closed

Tap reporter can produce invalid output due to stack trace #1257

jreichenberg opened this issue Jul 3, 2014 · 2 comments · Fixed by #3552
Labels
area: reporters involving a specific reporter status: accepting prs Mocha can use your help with this one!

Comments

@jreichenberg
Copy link

The tap reporter does the following on fail:

console.log(err.stack.replace(/^/gm, ' '));

Depending on the stack trace, this can produce invalid tap output. For example, a tap file with a stack trace from WebDriverJs is below...invalid (try it in http://instanttap.appspot.com/ ).

Ideas for sanitizing the stack trace?
Or providing an option to leave it on err.stack and not print it (so it can be potentially written as a file or written at the end)?

1..5
Selenium Server started on port 4444
Local http server listening at http://localhost:8080
Webdriver navigating to http://localhost:8080/test/ui/fixtures/index.html
ok 1 Instancing Toggle Switch from provided DOM data attribute should automatically instance a toggle button from the expected DOM
ok 2 Instancing Toggle Switch from dynamically-added DOM should not automatically instance a toggle button without the expected DOM
not ok 3 Instancing Toggle Switch from dynamically-added DOM should be instanced via JavaScript
  AssertionError: expected true to be false
      at <anonymous>
  ==== async task ====
  WebDriver.findElements(By.xpath("//input[last()]/ancestor::div[contains(@class, 'has-switch')]"))
      at webdriver.WebDriver.schedule (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:267:15)
      at webdriver.WebDriver.findElements (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:825:17)
      at webdriver.WebDriver.isElementPresent (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:787:29)
      at /Users/212362413/projects/dx-components/toggle-switch/test/ui/spec/toggle-switch-ui-spec.js:74:20
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at Object.webdriver.promise.asap (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:678:5)
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1456:25)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1312:10
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:613:51
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
      at IncomingMessage.<anonymous> (/Users/212362413/npm/lib/node_modules/selenium-webdriver/http/index.js:113:7)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:920:16
      at process._tickCallback (node.js:415:13)
  ==== async task ====
      at webdriver.promise.ControlFlow.wait (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1202:15)
      at webdriver.WebDriver.wait (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:546:21)
      at /Users/212362413/projects/dx-components/toggle-switch/test/ui/spec/toggle-switch-ui-spec.js:45:20
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at Object.webdriver.promise.asap (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:678:5)
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1456:25)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1312:10
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
      at webdriver.promise.ControlFlow.runInNewFrame_ (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
      at notify (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
      at notifyAll (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
      at fulfill (/Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:613:51
      at /Users/212362413/npm/lib/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
      at IncomingMessage.<anonymous> (/Users/212362413/npm/lib/node_modules/selenium-webdriver/http/index.js:113:7)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:920:16
      at process._tickCallback (node.js:415:13)
ok 4 Underlying form field interactions should set the "checked" property of the checkbox inside the toggle button
ok 5 Underlying form field interactions should unset the "checked" property of the checkbox inside the toggle button
# tests 5
# pass 4
# fail 1
@jreichenberg
Copy link
Author

The following subset of the above passes InstantTap (and would work well in the Jenkins Tap plugin, which is my goal...)

Prefixed all with "#"

1..5
Selenium Server started on port 4444
Local http server listening at http://localhost:8080
Webdriver navigating to http://localhost:8080/test/ui/fixtures/index.html
ok 1 Instancing Toggle Switch from provided DOM data attribute should automatically instance a toggle button from the expected DOM
ok 2 Instancing Toggle Switch from dynamically-added DOM should not automatically instance a toggle button without the expected DOM
not ok 3 Instancing Toggle Switch from dynamically-added DOM should be instanced via JavaScript
#AssertionError: expected true to be false
#      at <anonymous>
#  ==== async task ====
#  WebDriver.findElements(By.xpath("//input[last()]/ancestor::div[contains(@class, 'has-switch')]"))
#      at webdriver.WebDriver.schedule (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:267:15)
#      at webdriver.WebDriver.findElements (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:825:17)
#      at webdriver.WebDriver.isElementPresent (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:787:29)
#      at /Users/Shared/Jenkins/Home/jobs/test/workspace/toggle-switch/test/ui/spec/toggle-switch-ui-spec.js:74:20
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at Object.webdriver.promise.asap (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:678:5)
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1456:25)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1312:10
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:613:51
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
#      at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/selenium-webdriver/http/index.js:113:7)
#      at IncomingMessage.EventEmitter.emit (events.js:117:20)
#      at _stream_readable.js:920:16
#      at process._tickCallback (node.js:415:13)
#  ==== async task ====
#      at webdriver.promise.ControlFlow.wait (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1202:15)
#      at webdriver.WebDriver.wait (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:546:21)
#      at /Users/Shared/Jenkins/Home/jobs/test/workspace/toggle-switch/test/ui/spec/toggle-switch-ui-spec.js:45:20
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at Object.webdriver.promise.asap (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:678:5)
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1456:25)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1312:10
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/goog/base.js:1178:15
#      at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:1445:20)
#      at notify (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:328:12)
#      at notifyAll (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:297:7)
#      at fulfill (/usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:402:7)
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/promise.js:613:51
#      at /usr/local/lib/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
#      at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/selenium-webdriver/http/index.js:113:7)
#      at IncomingMessage.EventEmitter.emit (events.js:117:20)
#      at _stream_readable.js:920:16
#      at process._tickCallback (node.js:415:13)
ok 4 Underlying form field interactions should set the "checked" property of the checkbox inside the toggle button
ok 5 Underlying form field interactions should unset the "checked" property of the checkbox inside the toggle button
# tests 5
# pass 4
# fail 1

@jbnicolai
Copy link

@jreichenberg sounds good. Care to create a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: reporters involving a specific reporter status: accepting prs Mocha can use your help with this one!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants