Skip to content

Commit 18ef917

Browse files
author
Lauren McCarthy
committed
Merge branch 'master' of github.com:processing/p5.js
2 parents ef2a751 + 9bf4233 commit 18ef917

File tree

8 files changed

+1527
-158
lines changed

8 files changed

+1527
-158
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ p5.zip
1515
bower-repo/
1616
p5-website/
1717
.vscode/settings.json
18+
.nyc_output/*
19+
coverage/
20+
lib/p5-test.js

Gruntfile.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@ module.exports = grunt => {
261261

262262
mochaChrome: mochaConfig,
263263

264+
nyc: {
265+
report: {
266+
options: {
267+
reporter: ['text-summary', 'html']
268+
}
269+
}
270+
},
271+
264272
// This minifies the javascript into a single file and adds a banner to the
265273
// front of the file.
266274
uglify: {
@@ -459,9 +467,15 @@ module.exports = grunt => {
459467
grunt.loadNpmTasks('grunt-saucelabs');
460468
grunt.loadNpmTasks('grunt-karma');
461469
grunt.loadNpmTasks('grunt-contrib-clean');
470+
grunt.loadNpmTasks('grunt-simple-nyc');
462471

463472
// Create the multitasks.
464-
grunt.registerTask('build', ['browserify', 'browserify:min', 'uglify']);
473+
grunt.registerTask('build', [
474+
'browserify',
475+
'browserify:min',
476+
'uglify',
477+
'browserify:test'
478+
]);
465479
grunt.registerTask('lint-no-fix', [
466480
'yui', // required for eslint-samples
467481
'eslint:build',
@@ -476,13 +490,15 @@ module.exports = grunt => {
476490
'build',
477491
'connect:server',
478492
'mochaChrome',
479-
'mochaTest'
493+
'mochaTest',
494+
'nyc:report'
480495
]);
481496
grunt.registerTask('test:nobuild', [
482497
'eslint:test',
483498
'connect:server',
484499
'mochaChrome',
485-
'mochaTest'
500+
'mochaTest',
501+
'nyc:report'
486502
]);
487503
grunt.registerTask('yui', ['yuidoc:prod', 'clean:reference', 'minjson']);
488504
grunt.registerTask('yui:test', [

developer_docs/unit_testing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ In the repo root, use the following command in your terminal
1414
npm test
1515
```
1616

17+
## Test Coverage
18+
19+
Every time the tests are run, a coverage report is generated. This coverage report details which parts of which source code files were exercised by the test suite, effectively telling us how much of the codebase was tested.
20+
21+
A summary is printed out after running the tests, and you can view the detailed report at `coverage/index.html` in any web browser. You can run `open coverage/index.html` from the command line on Mac to open the page in your default web browser.
22+
1723
### Running One Suite
1824

1925
To run a single test or group of tests, append `.only` on a `suite` or `test` in your `.js` file and run the tests using the above command.

0 commit comments

Comments
 (0)