![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
grunt-qunit-blanket-lcov
Advanced tools
Save LCOV reports generated by Blanket for Grunt QUnit.
This is used to save Blanket.js tests coverage results done with grunt-contrib-qunit in order to send them to Coveralls.io with grunt-coveralls.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-qunit-blanket-lcov --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-qunit-blanket-lcov');
Simply follow Blanket.js guide to setup the test coverage with QUnit. No special configuration of the test suite is needed.
Your test HTML should look like :
<!DOCTYPE html>
<html>
<head>
<title>My test suite</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css">
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<script src="../bower_components/qunit/qunit/qunit.js"></script>
<script src="../bower_components/blanket/dist/qunit/blanket.min.js"></script>
<script src="../src/library.js" data-cover></script>
<script src="core.js"></script>
</head>
<body>
<!-- -->
</body>
</html>
Don't forget to change the urls
of the qunit
task to add ?coverage=true
for each test suite.
In your project's Gruntfile, add a section named qunit_blanket_lcov
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
qunit_blanket_lcov: {
lib: {
src: 'src/library.js',
options: {
prefix: 'http://localhost:<%= connect.test.options.port %>/',
dest: '.coverage-results/library.lcov'
}
}
}
});
Then add or edit your test
Grunt task to execute qunit_blanket_lcov
before qunit
.
grunt.registerTask('test', [
'qunit_blanket_lcov',
'qunit'
]);
Type: string
Required
Output file for LCOV data.
Type: string
Required
The prefix to remove from file paths, this is generally the host + port of the grunt-contrib-connect
task you use.
Type: boolean
Default value: false
By default the task will fail if there is no coverage results to write.
Type: boolean
Default value: true
Automatically insert the custom Blanket reporter in the PhantomJS instance. If you redefined the inject
option of grunt-contrib-qunit
you must set this option to false
and manually add node_modules/grunt-qunit-blanket-lcov/reporter.js
to the inject list.
In this example the test coverage results of library.js
will be saved to library.lcov
.
grunt.initConfig({
qunit_blanket_lcov: {
lib: {
src: 'src/library.js',
options: {
prefix: 'http://localhost:9001/',
dest: '.coverage-results/library.lcov'
}
}
}
});
If you have many source files used by QUnit analyzed by Blanket it might be a good idea to use the Grunt files globbing option.
grunt.initConfig({
qunit_blanket_lcov: {
all: {
files: [{
expand: true,
src: ['src/*.js', 'src/plugins/**/plugin.js']
}],
options: {
prefix: 'http://localhost:9001/',
dest: '.coverage-results/all.lcov'
}
}
}
});
FAQs
Save LCOV reports generated by Blanket for Grunt QUnit.
The npm package grunt-qunit-blanket-lcov receives a total of 2 weekly downloads. As such, grunt-qunit-blanket-lcov popularity was classified as not popular.
We found that grunt-qunit-blanket-lcov demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.