Gathering detailed insights and metrics for grunt-spec-check
Gathering detailed insights and metrics for grunt-spec-check
Gathering detailed insights and metrics for grunt-spec-check
Gathering detailed insights and metrics for grunt-spec-check
Find and list JavaScript files that do not have corresponding specs
npm install grunt-spec-check
Typescript
Module System
Min. Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Mar 16, 2015
Latest Version
0.1.0
Package Id
grunt-spec-check@0.1.0
Size
5.13 kB
NPM Version
1.4.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
Find and list JavaScript files that do not have corresponding specs / tests
This is a simple task to help find untested files. Code coverage tools like Istanbul are excellent for generating code coverage reports, however they generally do not alert you to files which are untested. This task will simply iterate through each file and check that there is a corresponding test case. The task can be configured to fail the build or just provide warnings, depending on how strict you want to be.
The task will not in anyway run the JavaScript files or check that the test case even does anything. It is a simple task to complement coverage tools by letting you know which files are untested.
This plugin requires Grunt ~0.4.5
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-spec-check --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
1grunt.loadNpmTasks('grunt-spec-check');
In your project's Gruntfile, add a section named specCheck
to the data object passed into grunt.initConfig()
.
1grunt.initConfig({
2 specCheck: {
3 options: {
4 // Task-specific options go here.
5 },
6 your_target: {
7 // Target-specific file lists and/or options go here.
8 },
9 },
10});
Type: String
Default value: /lib
A string value that corresponds to the location of the scripts that should be tested. When searching for a spec this section of the filepath is replaced with the value specified for testDir
Type: String
Default value: /test
A string value that corresponds to the location of your test files. It is assumed that the directory structure of your test files matches that of your tested files.
Type: String
Default value: 'fatal'
A string value that determines the severity of the failure.
Valid options are 'fatal'
(fails build) and 'warn'
Type: String
Default value: 'Spec.js'
A string value that corresponds to the convention for naming your test files.
The default is the Jasmine convention where 'file.js
' is tested by 'fileSpec.js
'
The task works by replacing '.js
' with the value provided here. So:
'.spec.js'
: file.js => file.spec.js
'Test.js'
: file.js
' => 'fileTest.js
In this example, we check for corresponding test cases for all JavaScript files, and throw a fatal warning if any test cases are missing.
1grunt.initConfig({ 2 specCheck: { 3 files: { 4 src: ["lib/**/*.js"] 5 }, 6 }, 7});
In this example, we check for corresponding test cases for all JavaScript files, but we exclude any debug files. Our test naming convention is to use the term Test instead of Spec, and we only want to list untested files and not fail the build. We are also using template properties to cut down on repeated file paths.
1grunt.initConfig({
2 app: {
3 'tests': 'src/test/resources/scripts',
4 'scripts': 'src/main/resources/scripts'
5 },
6 specCheck: {
7 options: {
8 convention: "Test.js"
9 severity: "warn",
10 testDir: "<%= app.scripts %>",
11 baseDir: "<%= app.tests %>"
12 }
13 files: {
14 src: [
15 "<%= app.scripts %>/**/*.js",
16 "!<%= app.scripts %>/**/*debug.js",
17 ]
18 },
19 },
20});
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/17 approved changesets -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
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