]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add `gulp unittest --coverage` argument (#4075)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 25 Mar 2017 17:26:45 +0000 (18:26 +0100)
committerGitHub <noreply@github.com>
Sat, 25 Mar 2017 17:26:45 +0000 (18:26 +0100)
Coverage data are now generated by running `gulp unittest` with the `--coverage` argument: unit tests are then executed a single time on Travis. The gulp `coverage` task has been removed and `karma.coverage.conf.ci.js` merged into `karma.conf.ci.js`.

Update documentation with gulp commands (and remove them from `README.md`) and remove unused `config.jshintrc` (oversight from #3256). Delete `thankyou.md` which has been merged into `README.md`.

.travis.yml
README.md
config.jshintrc [deleted file]
docs/developers/contributing.md
gulpfile.js
karma.conf.js
karma.coverage.conf.js [deleted file]
thankyou.md [deleted file]

index 2df4a4cd7917de72cc45a4027a8cde87ef73b3e3..d99266137b610347718884e021720d3658fe3a4f 100644 (file)
@@ -12,8 +12,7 @@ before_script:
 
 script:
   - gulp build
-  - gulp test
-  - gulp coverage
+  - gulp test --coverage
   - gulp package
   - gulp bower
   - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
index daec17a46ddf9d430129ca28e7719dd038a26952..4b0ab288409a9e2002641ac9970a2a52f9a5f87e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,21 +33,14 @@ You can find documentation at [www.chartjs.org/docs](http://www.chartjs.org/docs
 
 ## Contributing
 
-Before submitting an issue or a pull request to the project, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md) first.
+Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md) first. For support using Chart.js, please post questions with the [`chartjs` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/chartjs).
 
-For support using Chart.js, please post questions with the [`chartjs` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/chartjs).
+## Building
+Instructions on building and testing Chart.js can be found in [the documentation](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md#building-and-testing).
 
-## Building and Testing
-
-To build, run `gulp build`.
-
-To test, run `gulp test`.
-
-To test against code standards, run `gulp lint`.
-
-More information on building and testing can be found in [gulpfile.js](gulpfile.js).
-
-Thanks to [BrowserStack](https://browserstack.com) for allowing our team to test on thousands of browsers.
+## Thanks
+- [BrowserStack](https://browserstack.com) for allowing our team to test on thousands of browsers.
+- [@n8agrin](https://twitter.com/n8agrin) for the Twitter handle donation.
 
 ## License
 
diff --git a/config.jshintrc b/config.jshintrc
deleted file mode 100644 (file)
index 00b4202..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-       "node": true,
-       "unused": true,
-       "predef": [ "require", "module" ]
-}
\ No newline at end of file
index 67c391db5a5ff9fea06cc08c66193dbdc8a8ac8d..70908dd6dbc4165d78c548b5a3f9fdc12dcfb67b 100644 (file)
@@ -9,26 +9,34 @@ New contributions to the library are welcome, but we ask that you please follow
 - Keep pull requests concise, and document new functionality in the relevant `.md` file.
 - Consider whether your changes are useful for all users, or if creating a Chart.js plugin would be more appropriate.
 
-# Building Chart.js
+# Building and Testing
 
 Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file.
 
 Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following:
 
 ```bash
-npm install
-npm install -g gulp
+npm install
+npm install -g gulp
 ```
 
 This will install the local development dependencies for Chart.js, along with a CLI for the JavaScript task runner <a href="http://gulpjs.com/" target="_blank">gulp</a>.
 
-Now, we can run the `gulp build` task.
+The following commands are now available from the repository root:
 
 ```bash
-gulp build
+> gulp build                // build Chart.js in ./dist
+> gulp unittest             // run tests from ./test/specs
+> gulp unittest --watch     // run tests and watch for source changes
+> gulp unittest --coverage  // run tests and generate coverage reports in ./coverage
+> gulp lint                 // perform code linting (ESLint)
+> gulp test                 // perform code linting and run unit tests
+> gulp docs                 // build the documentation in ./dist/docs
 ```
 
-# Bugs & issues
+More information can be found in [gulpfile.js](https://github.com/chartjs/Chart.js/blob/master/gulpfile.js).
+
+# Bugs and Issues
 
 Please report these on the GitHub page - at <a href="https://github.com/chartjs/Chart.js" target="_blank">github.com/chartjs/Chart.js</a>. If you could include a link to a simple <a href="http://jsbin.com/" target="_blank">jsbin</a> or similar to demonstrate the issue, that'd be really helpful.
 
index 785004b2c383007b7adfeff2bd0ac3a83d284251..884242f05b1b6119b4e6d56df20bbf3034383dc5 100644 (file)
@@ -38,7 +38,6 @@ var header = "/*!\n" +
 gulp.task('bower', bowerTask);
 gulp.task('build', buildTask);
 gulp.task('package', packageTask);
-gulp.task('coverage', coverageTask);
 gulp.task('watch', watchTask);
 gulp.task('lint', lintTask);
 gulp.task('docs', docsTask);
@@ -202,14 +201,9 @@ function unittestTask(done) {
     configFile: path.join(__dirname, 'karma.conf.js'),
     singleRun: !argv.watch,
     files: startTest(),
-  }, done).start();
-}
-
-function coverageTask(done) {
-  new karma.Server({
-    configFile: path.join(__dirname, 'karma.coverage.conf.js'),
-    files: startTest(),
-    singleRun: true,
+    args: {
+      coverage: !!argv.coverage
+    }
   }, done).start();
 }
 
index 39e5ae61abcdd9f4526d3f0bef2902053109ceea..3ef7f49bfa73daa68fc224a95be79f6f2f2f4820 100644 (file)
@@ -1,6 +1,7 @@
 /* eslint camelcase: 0 */
 
 module.exports = function(karma) {
+       var args = karma.args || {};
        var config = {
                browsers: ['Firefox'],
                frameworks: ['browserify', 'jasmine'],
@@ -29,5 +30,19 @@ module.exports = function(karma) {
                config.browsers.push('Chrome');
        }
 
+       if (args.coverage) {
+               config.reporters.push('coverage');
+               config.browserify.transform = ['browserify-istanbul'];
+
+               // https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md
+               config.coverageReporter = {
+                       dir: 'coverage/',
+                       reporters: [
+                               {type: 'html', subdir: 'report-html'},
+                               {type: 'lcovonly', subdir: '.', file: 'lcov.info'}
+                       ]
+               };
+       }
+
        karma.set(config);
 };
diff --git a/karma.coverage.conf.js b/karma.coverage.conf.js
deleted file mode 100644 (file)
index 4975f16..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-module.exports = function(config) {
-       var configuration = {
-               browsers: ['Firefox'],
-               frameworks: ['browserify', 'jasmine'],
-               reporters: ['progress', 'coverage'],
-
-               preprocessors: {
-                       './test/jasmine.index.js': ['browserify'],
-                       './src/**/*.js': ['browserify']
-               },
-
-               browserify: {
-                       debug: true,
-                       transform: [['browserify-istanbul', {
-                               instrumenterConfig: {
-                                       embed: true
-                               }
-                       }]]
-               },
-
-               coverageReporter: {
-                       dir: 'coverage/',
-                       reporters: [
-                               { type: 'html', subdir: 'report-html' },
-                               { type: 'lcovonly', subdir: '.', file: 'lcov.info' }
-                       ]
-               }
-       };
-
-       // If on the CI, use the CI chrome launcher
-       if (process.env.TRAVIS) {
-               configuration.browsers.push('Chrome_travis_ci');
-               configuration.customLaunchers = {
-                       Chrome_travis_ci: {
-                               base: 'Chrome',
-                               flags: ['--no-sandbox']
-                       }
-               };
-       } else {
-               configuration.browsers.push('Chrome');
-       }
-
-       config.set(configuration);
-};
\ No newline at end of file
diff --git a/thankyou.md b/thankyou.md
deleted file mode 100644 (file)
index 1300c2a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-## Thanks go out to:
-
-- **@n8agrin** - Twitter handle donation!