Wallaby.js Advanced Logging (05)

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.log

Yes, 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).

Live Comments

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.evalue and returns $.

In this /* */different from console.logat maximum convenience it is that it has some built-in intelligent configuration. If you put Promiseit automatically prints out the results of resolve, if it is placed Observablewill be printed.

Finally, this particular usage due to compiler restrictions do not apply CoffeeScript.

Performance Tips

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.

configuration

The 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)


Guess you like

Origin www.cnblogs.com/petewell/p/11457744.html