Version 1.0.3
@stackline/blanket
Maintained Blanket.js 1.2.3 compatibility fork with directive-safe coverage instrumentation
Independent Stackline maintenance of blanket 1.2.3. The published license and original attribution are retained.
- npm 1.0.0
- License: MIT
- Node.js:
>=20
Installation
npm install --save-dev --save-exact @stackline/blanket@1.0.3To keep the upstream import name:
npm install --save-dev --save-exact blanket@npm:@stackline/blanket@1.0.3Usage and API
@stackline/blanket
Maintained Blanket.js 1.2.3 compatibility fork with directive-safe coverage instrumentation.
Documentation | npm | Issues | Repository
Current package version: 1.0.3
Why this package?
This is a maintained compatibility fork of the MIT-licensed blanket@1.2.3 coverage instrumenter.
Version 1.0.0 fixed upstream issue #340: coverage counters no longer precede a function's directive prologue and accidentally disable strict mode. Program directives keep their order before coverage initialization; strictness does not leak between instrumented files. Ordinary string expressions, parenthesized strings, and escaped lookalikes do not become strict directives.
The implementation retains Blanket's instrumentation and coverage format. Its small MIT-licensed parser-walking and options-copying helpers are included internally, with attribution, and obsolete compatibility-shim dependencies are removed. Acorn is the single runtime dependency. The QUnit, Mocha, and Jasmine bundles, including their minified variants, are rebuilt from the same corrected source.
Compatibility
| Item | Value |
|---|---|
| Package | @stackline/blanket@1.0.3 |
| Supported Node.js | >=20 |
| Module entry | src/index.js (CommonJS) |
| Runtime dependencies | 1 direct dependency |
Browser bundles require ES5 array/object methods and a browser supported by the selected test framework. The default parser remains configured for ECMAScript 5; updating the parser does not make the legacy instrumenter support every newer syntax feature.
Installation
npm install --save-dev @stackline/blanket
The legacy Mocha require hook accepts the scoped name:
mocha --require @stackline/blanket
Usage
const blanket = require('@stackline/blanket')({ engineOnly: true });
const instrumented = blanket.instrumentSync({
inputFile: "function example() { 'use strict'; return this; }",
inputFileName: 'example.js'
});
Security
Instrumentation preserves directive prologues, including use strict. The default parser targets ECMAScript 5; newer parser dependencies do not imply support for every newer language feature.
API Surface
The full historical options and API reference are preserved in README.upstream.md. The compatibility notes above describe changes in the maintained package.
Local Development
Clone the repository and run the following commands from its root:
npm ci
npm run build
npm test
Tests cover strict-mode behavior, directive order, counters, callbacks, branch data, a real CommonJS require hook, and all six distributed browser instrumenters in VM browser contexts. Full browser-runner UI behavior and every historical framework version are not covered. The old Mocha html-cov reporter is a separate integration concern; this fork does not restore a reporter removed by Mocha.
Release Checklist
- Update the package version, lockfile, generated version fields, and changelog together.
- Run the development checks above and audit both
npm auditandnpm audit --omit=dev. - Use the GitHub publish workflow with its
Prodenvironment to publish the exact CI tarball. - Verify public npm bytes, package identity, provenance, and the immutable GitHub release evidence.
License
MIT. Original copyright notices and upstream attribution are retained.
See UPSTREAM.md and THIRD_PARTY_NOTICES.md for the source basis and bundled helper attribution.
Credits and original authors
- Original project: blanket.
- Alex-Seville.
- Copyright (c) 2013 Alex Seville.
- Stackline maintenance: Alexandro Paixao Marques and Stackline contributors.
Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.
Community and Links
Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.
Historical upstream configuration
Blanket.js
A seamless JavaScript code coverage library.
FYI: Please note that this repo is not actively maintained
If you're looking for a more active project for JavaScript code coverage, I recommend Istanbul.
Project home page
Blanket_js on Twitter for updates and news.
NOTE: All Pull-Requests must be made into the master branch.
Build Status Dependency Status devDependency Status
- Getting Started
- Philosophy
- Mechanism
- Grunt Integration
- Compatibility & Features List
- Roll Your Own
- Development
- Contact
- Contributors
- Revision History
NOTE: Blanket.js will throw XHR cross domain errors if run with the file:// protocol. See Special Features Guide for more details and workarounds.
Getting Started
Please see the following guides for using Blanket.js:
Browser
- Getting Started (Basic QUnit usage)
- Intermediate (Other test runners, global options)
- Advanced (writing your own reporters/adapters)
- Special Features Guide
Node
- Getting Started (basic mocha setup)
- Intermediate (mocha testrunner, travis-ci reporter)
- Intermediate 2 (mocha, htmlcov, package.json setup)
Configuration
- Options (Browser and Node)
Philosophy
Blanket.js is a code coverage tool for javascript that aims to be:
- Easy to install
- Easy to use
- Easy to understand
Blanket.js can be run seamlessly or can be customized for your needs.
Mechanism
JavaScript code coverage compliments your existing JavaScript tests by adding code coverage statistics (which lines of your source code are covered by your tests).
Blanket works in a 3 step process:
- Loading your source files
- Parsing the code using Esprima and node-falafel, and instrumenting the file by adding code tracking lines.
- Connecting to hooks in the test runner to output the coverage details after the tests have completed.
Grunt Integration
You've got a few options for using Grunt with Blanket:
grunt-blanket
A Grunt plugin has been created to allow you to use Blanket like a "traditional" code coverage tool (creating instrumented copies of physical files, as opposed to live-instrumenting). The plugin runs as a standlone project and can be found here.
grunt-blanket-qunit
Runs the QUnit-based Blanket report headlessly using PhantomJS. Results are displayed on the console, and the task will cause Grunt to fail if any of your configured coverage thresholds are not met. Minimum code coverage thresholds can be configured per-file, per-module, and globally.
See:
Compatibility and Features List
See the Compatiblity and Feature List including links to working examples.
Roll your own
git clone git@github.com:alex-seville/blanket.gitnpm install- Add your custom build details to the grunt.js file under
concat npm run build
A minified and unminfied copy of the source can be created (see the min task).
Development
All development takes place on the master branch
Your pull request must pass all tests (run npm test to be sure) and respect all existing coverage thresholds
Contact
Feel free to add questions to the Issue tracker, or send them to @blanket_js.
Contributors
Thanks to the many people who have contributed to the project.
And thanks also to: RequireJS, Esprima, node-falafel, Mocha, Qunit.
Revision History
Feb 18-15 - 1.2.2 PR's merged, but this project is not actively maintained.
May 1-13 - 1.1.4
Loaded reverting for grunt-blanket, branch tracking reporter fixed, coverage on-the-go (displaying coverage results while a single page is being used).
Apr 28-13 - 1.1.3 YUI support added with custom adapter (and some wrapping code). CompoundJS support appears to be outside the scope of project.
... (see full revision history)
License
Copyright (c) 2012-2013 Alex Seville
Licensed under the MIT license.
Origin and compatibility notes
Upstream basis
- Package:
blanket@1.2.3, published 2016-03-19. - Registry artifact: https://registry.npmjs.org/blanket/-/blanket-1.2.3.tgz
- Integrity:
sha512-u0jo0RgUaVK45tEWOBq8BhexulW74S0NcGmmqTXRyCc3bSl76TQgk6+NP0/+EWvBVAMBMyd9AffGXKFWkN8Eww==. - Upstream project: https://github.com/alex-seville/blanket
- Original release-era commit: 8047c29f338d60f7e39522ba07045f8556f7b4b8.
- License: the plain MIT license from the published 1.2.3 artifact. The original LICENSE and Alex Seville attribution are retained. This fork does not import the different license subsequently placed on the upstream default branch.
The initial import is the exact published npm artifact. Browser distribution files are now rebuilt with a small Node.js script, using the same source and adapter ordering as the release-era Grunt configuration. The obsolete Grunt/PhantomJS development toolchain is not needed.
The directive fix addresses #340, confirmed against the published artifact. It preserves actual directive prologues and avoids carrying program-level strictness into the next file. Regression tests execute the generated code and published browser bundles.
The internal falafel helper derives from version 1.2.0, with native array/object helpers replacing old shims. The xtend helper retains the implementation from version 4.0.2. Acorn is updated while the default ecmaVersion: 5 setting remains. Full third-party license text is in THIRD_PARTY_NOTICES.md.
No vulnerability claim is made: the isolated published baseline runtime installation had no npm audit advisories on 2026-09-27. This fork has its own 1.x version series and does not imply upstream endorsement.
Published files and origin
- LICENSE
- README.md
- README.upstream.md
- THIRD_PARTY_NOTICES.md
- UPSTREAM.md
- Package and archive metadata
- Full text documentation
- Exact npm archive
These documents were read from the existing npm 1.0.0 archive. Its SHA-512 matches the current registry integrity value. This documentation update does not publish a new package or establish a new provenance or immutable-release verification.
Archive integrity
sha512-WNqtyPrIxS9KT1JRg2Ngrv0D6vl2bHnIJEnF/MixPNac/krres/FPRt6jfJYzTv9ZCu20YmNxHqF1uzrJdi9/Q==