Gathering detailed insights and metrics for grunt-contrib-nodeunit
Gathering detailed insights and metrics for grunt-contrib-nodeunit
Gathering detailed insights and metrics for grunt-contrib-nodeunit
Gathering detailed insights and metrics for grunt-contrib-nodeunit
npm install grunt-contrib-nodeunit
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
70 Stars
139 Commits
27 Forks
7 Watching
5 Branches
23 Contributors
Updated on 20 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-9.1%
3,682
Compared to previous day
Last week
-24.1%
24,144
Compared to previous week
Last month
49.7%
122,493
Compared to previous month
Last year
-3.7%
984,909
Compared to previous year
1
Run Nodeunit unit tests
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:
1npm install grunt-contrib-nodeunit --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
1grunt.loadNpmTasks('grunt-contrib-nodeunit');
Run this task with the grunt nodeunit
command.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
This plugin provides server-side JavaScript unit testing via nodeunit. If you're looking to test JavaScript that uses window
or the DOM, please use the grunt-contrib-qunit pluginqunit
task.
There may be a few differences versus running nodeunit
on the command line:
Nodeunit's reporters (such as default
) are in charge of tracking tests that do not complete. They often hook
into process.on('exit')
. Since grunt
is handling the runtime, it does not exit, so the reporter's clean-up code
that monitors undone tests does not fire. Additionally, the reporters do not expose the number of "Undone" tests in their
completion callbacks.
This can cause problems. For example, if an exception is thrown in an undone test, the exception might bubble up into the
grunt
runtime if it's still running. This would cause grunt
to exit, while nodeunit
command line would show the undone
test.
If you're getting strange grunt
runtime errors or seeing grunt
exit, check for "undone" tests.
Type: String
Default: 'grunt'
Specifies the reporter you want to use. For example, default
, verbose
or tap
.
Type: Boolean
Default: false
Specifies the file the reporter
's output should be saved to. For example, tests.tap
.
Type: Object
Default: {}
Specifies the options passed to the reporter
. For example, the junit
reporter requires the output
option
to be set:
1grunt.initConfig({
2 nodeunit: {
3 all: ['test/*_test.js'],
4 options: {
5 reporter: 'junit',
6 reporterOptions: {
7 output: 'outputdir'
8 }
9 }
10 }
11});
In this example, grunt nodeunit:all
or grunt nodeunit
will test all files ending with _test.js
in the test
directory.
1grunt.initConfig({
2 nodeunit: {
3 all: ['test/*_test.js']
4 }
5});
With a slight modification, grunt nodeunit:all
will test files matching the same pattern in the test
directory and all subdirectories.
1grunt.initConfig({ 2 nodeunit: { 3 all: ['test/**/*_test.js'] 4 } 5});
To use a reporter other than the default one, you can specify the reporter
and reporterOutput
parameters.
1grunt.initConfig({
2 nodeunit: {
3 all: ['test/*_test.js'],
4 options: {
5 reporter: 'tap',
6 reporterOutput: 'tests.tap',
7 reporterOptions: {
8 output: 'outputdir'
9 }
10 }
11 }
12});
error.stack
exists.reporter
and reporterOutput
options.this.filesSrc
API.this.file
API internally.Task submitted by "Cowboy" Ben Alman
This is a generated file.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 3/16 approved changesets -- score normalized to 1
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More