This article describes how to use Log In Wallaby.js Living Testing state.
There are three methods you can quickly print out output in the editor.
console.logYes, just like in the browser DevTool as intuition, using it right!
Identifying expression (Identifier expressions)Another simple method is to write the variable name. Please note that only simple identifier expression is automatically printed as an example of age
, but not other types of expressions (such as age.test1 () or age.test).
It is well supported by annotations to print out anything that you want to monitor.
Insert /*?*/
after line of code will print any value.
You can also print any JavaScript code in the comment. A special feature is $
the variable (which is attached notes are an expression, understood as the result of the implementation of that variable line). Please note, annotation and no restrictions. For example, the notes just below the increase in d.e
value and returns $
.
In this /* */
different from console.log
at maximum convenience it is that it has some built-in intelligent configuration. If you put Promise
it automatically prints out the results of resolve, if it is placed Observable
will be printed.
Finally, this particular usage due to compiler restrictions do not apply CoffeeScript
.
Quick View implementation of the various parts of the code for the application process bottlenecks and optimize performance might help. Insert Special Notes /*?.*/
will show the execution time.
The annotation is placed inside the loop execution time shows, on the outside can see the overall execution time.
configurationThe default value ( ?
) configuration can be changed in the wallaby. It will be changed as follows out:
:
module.exports = function (wallaby) {
return {
...
hints: {
commentAutoLog: 'out:'
}
};
};
Data Source: Introduction: Advanced Logging
原文:大专栏 Wallaby.js 进阶 Logging (05)