nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.82k stars 1.32k forks source link

Source map support #1172

Open IceCreamYou opened 8 years ago

IceCreamYou commented 8 years ago

I am using Nightwatch in a TypeScript project and compiling the files to ES5 in CommonJS format. This allows me to use Nightwatch, and it's working well.

However, when tests fail, I get output like this:

 ✖ Testing if element <#main> contains text: "Night Watch".  - expected "Night Watch" but got: ""
  at Object.Demo test Google (/Users/isaac/Code/frontend/tests/functional/demo-functional.js:13:21)
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

Because the error points to (in this case) demo-functional.js instead of demo-functional.ts, it's harder to track down and debug. If Nightwatch could follow the source maps and output the TypeScript file / location in error messages, debugging would be easier. This use case also applies to people using ES2015+ with a transpiler like Babel, or other compile-to-JavaScript languages like CoffeeScript, Dart, ClojureScript, etc. This is a pretty big install base, and since TypeScript is the default now for Angular 2, and it seems like most new JavaScript projects are using transpilers of some sort, I expect the desire for this feature to grow.

Implementing support for source maps can potentially be made easier using the node-source-map-support npm module. Its purpose seems to be to instrument V8 so that it follows source maps in stack traces.

(I did search for other similar issues before posting this and didn't find anything, but sorry if this is a duplicate.)

avkonst commented 7 years ago

is there any update for this?