-
Notifications
You must be signed in to change notification settings - Fork 45
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
Wallaby.js Tests output not reporting filename in VS Code #677
Comments
hmmm it's even worse on errors:
👆 this is bad :( |
Wallaby.js actually supports a couple of powerful navigation commands allowing you to jump to a failing test from anywhere. Check out the "Jump to" commands, when invoked from the line of code it will let you jump to the failing test that covers the line (or to the first failing test if the code is not covered by a failing test). With the links inside the Wallaby Tests output channel, custom links options are quite limited (here is the feature request in the VS Code repo), but as you can see on the GIF above, wallaby does provide stack links (when it can). In your case it looks like the error stack is not displayed. It may or may not be specific to your tests/environment. If you run plain mocha and it does it display the error stacks correctly in the terminal, wallaby should be able to do it as well. If it's not the case, could you please share a sample project (attached or on GitHub) where I could reproduce it? Happy to have a look. |
It looks like it is outputting stack traces but the async nature of the tests is causing the stack not to walk all the way back into the test file:
|
Testsdescribe.only('test with async', function(){
it('prints stack with promise.reject', function(){
return Promise.reject('bad!! :(');
})
it('prints stack with new promise reject with timeout', function(){
return new Promise(function(resolve, reject){
setTimeout(reject.bind(null, new Error('rejected local 1')),1000);
});
})
it('prints stack with new promise reject in EXTERNAL file', function(){
return require('./rejector.js')();
})
it('prints stack with new promise reject in EXTERNAL file accessing async API', function(){
return require('./fs-rejector.js')();
})
it('prints stack with done(error)', function(done){
setTimeout(function(){
done(new Error('rejected local 2'));
},1000);
})
})
|
Not sure if this is a mocha bug or a node.js bug |
Looks like plain mocha is pretty consistent with wallaby:
This one is simple, you are rejecting with a string, so the testing framework can't get the stack trace. If you change it to reject with an error, it should be better (in both plain mocha and wallaby): it('prints stack with promise.reject', function () {
return Promise.reject(new Error('bad!! :('));
})
This one is just a limitation of native ES6 promises. When the error is raised asynchronously, native promise just doesn't keep the previous stack. One way to fix it would be to use an enhancer of the native promises, such as module.exports = function () {
return {
...
setup: function(wallaby){
global.Promise = require('bluebird');
Promise.longStackTraces();
}
};
};
Please let me know if addresses the raised issue and answers your question. |
I think that answers my questions, thanks! |
Issue description or question
I'd like to be able to jump to the failing test by clicking on it.
Wallaby.js configuration file
Code editor or IDE name and version
Visual Studio Code Version 1.2.1 (1.2.1)
OS name and version
OSX 10.11.5 (15F34)
Test output:
I have no way to get to the files besides "find in project" on part of the test description, but that's no better than just running in terminal.
The text was updated successfully, but these errors were encountered: