liveBook · Manning

Instrumentation

As explained in Functional Programming in JavaScript

The process of inserting tracking code into software so execution behavior can be observed or measured.

Instrumentation inserts tracker lines into program code so statement execution can be observed during tests. In JavaScript coverage analysis, it forms the middle of a three-phase process: load source files, instrument the code, then connect test-runner hooks to report coverage. section 6.5

A coverage workflow proceeds by:

Instrumenting a JavaScript file

A script include such as <script src="imperative-show-student-program.js" data-cover></script> marks a JavaScript program for coverage collection. Blanket.js can then report which statements ran during QUnit tests. section 6.5

<script src="imperative-show-student-program.js" data-cover></script>

View the script include that enables coverage instrumentation for the imperative example. section 6.5

How Functional Programming in JavaScript covers it

How deep it goes
Explains a three-phase workflow and tracker-line mechanism, but defers detailed setup to an appendix.
Examples
Uses Blanket.js, QUnit, script attributes, and imperative and functional showStudent tests.
What it assumes
Assumes existing JavaScript unit tests and introduces coverage instrumentation as their measurement complement.
What you can do after
Apply it via Blanket.js to collect and display JavaScript statement-coverage results.
How it connects
Connects instrumentation with code coverage, unit testing, statement coverage, and test runners.

Also explained in

Compare how 13 books explain instrumentation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.