mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Add gulp unittest --coverage
argument (#4075)
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`.
This commit is contained in:
parent
90d458a6d9
commit
e3f3b8978b
@ -12,8 +12,7 @@ before_script:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- gulp build
|
- gulp build
|
||||||
- gulp test
|
- gulp test --coverage
|
||||||
- gulp coverage
|
|
||||||
- gulp package
|
- gulp package
|
||||||
- gulp bower
|
- gulp bower
|
||||||
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
|
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
|
||||||
|
19
README.md
19
README.md
@ -33,21 +33,14 @@ You can find documentation at [www.chartjs.org/docs](http://www.chartjs.org/docs
|
|||||||
|
|
||||||
## Contributing
|
## 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
|
## Thanks
|
||||||
|
- [BrowserStack](https://browserstack.com) for allowing our team to test on thousands of browsers.
|
||||||
To build, run `gulp build`.
|
- [@n8agrin](https://twitter.com/n8agrin) for the Twitter handle donation.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"node": true,
|
|
||||||
"unused": true,
|
|
||||||
"predef": [ "require", "module" ]
|
|
||||||
}
|
|
@ -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.
|
- 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.
|
- 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.
|
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:
|
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
|
```bash
|
||||||
npm install
|
> npm install
|
||||||
npm install -g gulp
|
> 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>.
|
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
|
```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.
|
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.
|
||||||
|
|
||||||
|
12
gulpfile.js
12
gulpfile.js
@ -38,7 +38,6 @@ var header = "/*!\n" +
|
|||||||
gulp.task('bower', bowerTask);
|
gulp.task('bower', bowerTask);
|
||||||
gulp.task('build', buildTask);
|
gulp.task('build', buildTask);
|
||||||
gulp.task('package', packageTask);
|
gulp.task('package', packageTask);
|
||||||
gulp.task('coverage', coverageTask);
|
|
||||||
gulp.task('watch', watchTask);
|
gulp.task('watch', watchTask);
|
||||||
gulp.task('lint', lintTask);
|
gulp.task('lint', lintTask);
|
||||||
gulp.task('docs', docsTask);
|
gulp.task('docs', docsTask);
|
||||||
@ -202,14 +201,9 @@ function unittestTask(done) {
|
|||||||
configFile: path.join(__dirname, 'karma.conf.js'),
|
configFile: path.join(__dirname, 'karma.conf.js'),
|
||||||
singleRun: !argv.watch,
|
singleRun: !argv.watch,
|
||||||
files: startTest(),
|
files: startTest(),
|
||||||
}, done).start();
|
args: {
|
||||||
}
|
coverage: !!argv.coverage
|
||||||
|
}
|
||||||
function coverageTask(done) {
|
|
||||||
new karma.Server({
|
|
||||||
configFile: path.join(__dirname, 'karma.coverage.conf.js'),
|
|
||||||
files: startTest(),
|
|
||||||
singleRun: true,
|
|
||||||
}, done).start();
|
}, done).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint camelcase: 0 */
|
/* eslint camelcase: 0 */
|
||||||
|
|
||||||
module.exports = function(karma) {
|
module.exports = function(karma) {
|
||||||
|
var args = karma.args || {};
|
||||||
var config = {
|
var config = {
|
||||||
browsers: ['Firefox'],
|
browsers: ['Firefox'],
|
||||||
frameworks: ['browserify', 'jasmine'],
|
frameworks: ['browserify', 'jasmine'],
|
||||||
@ -29,5 +30,19 @@ module.exports = function(karma) {
|
|||||||
config.browsers.push('Chrome');
|
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);
|
karma.set(config);
|
||||||
};
|
};
|
||||||
|
@ -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);
|
|
||||||
};
|
|
@ -1,3 +0,0 @@
|
|||||||
## Thanks go out to:
|
|
||||||
|
|
||||||
- **@n8agrin** - Twitter handle donation!
|
|
Loading…
Reference in New Issue
Block a user