Skip to content

throw [jscoverage] unknow ENV! error when define variable window #24

Open
@hotoo

Description

@hotoo

https://github.com/fishbar/jscoverage/blob/master/lib/jscoverage.js#L36

    if (typeof global === 'object') {
      BASE = global;
    } else if (typeof window === 'object') {
      BASE = window;
    } else {
      throw new Error('[jscoverage] unknow ENV!');
    }

when my code has variable window,

var window = this; // this ref to window.
console.log(typeof window);

will console log object run in node, build as cmd module and run in web, or run in phantom.
but throw error [jscoverage] unknow ENV! here, why?

ref

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions