coverjs

coverjs allows your code to be instrumented. This essentially means it allows your code to be measured or monitored in terms of performance.

The coverjs loader does not need to be combined with mocha-loader, as it is independent. The reportHtml function will append to the output of the body.

In the following example, webpackOptions.js is the subject of the code. In the first set of curly braces ({) are the options related to the module export procedures. In the double-set of braces ([{) is the code that binds the coverjs loader and the test:"" statement (which indicates that every file will be tested):

webpack - dev - server "mocha!./cover-my-client-tests.js"--options webpackOptions.js
// webpackOptions.js
module.exports = {
output: "bundle.js",
publicPrefix: "/",
debug: true,
includeFilenames: true,
watch: true,
postLoaders: [{
test: "",
exclude: [
"node_modules.chai",
"node_modules.coverjs-loader",
"node_modules.webpack.buildin"
],
loader: "coverjs-loader"
}]
}
// cover-my-client-tests.js
require("./my-client-tests");
after(function() {
require("cover-loader").reportHtml();
});

As you can see, this particular loader has its options set through a local file. Amendments to this will have the same effect as the configuration discussed in the previous chapter. That should be all you need to get coverjs up and running in your application. Next up is a more complicated topic, involving the use of international languages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.161.222