Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Do not instrument Identifier when preceded by typeof #33

merged 1 commit into from

2 participants


When an identifier isn't declared, it's valid to use it in one specific expression:

 typeof foo; // 'undefined'

Since it's instrumented by node-cover, it fails.

cover run test.js
ReferenceError: foo is not defined

This pull request remove the instrumentation of identifiers when their parent node is a typeof operator.


Any comment on that PR, @itay ?


Looks great, sorry for delay!

@itay itay merged commit e746849 into from
@floriancargoet floriancargoet deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 instrument.js
5 instrument.js
@@ -388,6 +388,11 @@ Instrumentor.prototype.wrap = function(tree, ignoredLines) {
parent.type == 'DoWhileStatement'))) {
+ // Do not instrument Identifier when preceded by typeof
+ if (parent.operator == 'typeof') {
+ return;
+ }
var newNode = {
"type": "SequenceExpression",
Something went wrong with that request. Please try again.