From fcff3a5880bb4a6d486aa255ea9fa3a179dc90c2 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Thu, 21 Dec 2017 04:01:07 +0000 Subject: [PATCH 1/3] Add test method using mocha --- .github/PULL_REQUEST_TEMPLATE.md | 8 ++++++++ .gitignore | 6 ++++++ .travis.yml | 21 +++++++++++++++++++++ Gruntfile.js | 25 +++++++++++++++++++++++++ package.json | 7 +++++++ 5 files changed, 67 insertions(+) create mode 100644 .travis.yml create mode 100644 Gruntfile.js diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9091f94..d25886c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,3 +10,11 @@ _Put an `x` in the boxes that apply_ Describe the nature of this change. What problem does it address? +## Checklist +_Put an `x` in the boxes that apply_ + +- [ ] I have read the [contribution guidelines](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md) +- [ ] For non-bugfix PRs, I have discussed this change on the mailing list/slack team. +- [ ] I have run `grunt` to verify the unit tests pass +- [ ] I have added suitable unit tests to cover the new/changed functionality + diff --git a/.gitignore b/.gitignore index 1c291f8..126f547 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,9 @@ node-red-node-* # Dependency directory node_modules + +# Coverage result +coverage + +# npm install log +npm-debug.log.* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..574685a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +sudo: false +language: node_js +env: + - CXX="g++-4.8" +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + - gcc-4.8 +node_js: + - "8" + - "7" + - "6" + - "4" +script: + - istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage +before_script: + - npm install -g istanbul + - npm install coveralls diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..23ffcaf --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,25 @@ +module.exports = function (grunt) { + grunt.initConfig({ + simplemocha: { + options: { + timeout: 3000 + }, + all: { + src: [ 'test/**/*_spec.js' ] + } + }, + mocha_istanbul: { + options: { + timeout: 3000 + }, + coverage: { + src: [ 'test/**/*_spec.js' ] + } + } + }); + grunt.loadNpmTasks('grunt-simple-mocha'); + grunt.loadNpmTasks('grunt-mocha-istanbul'); + grunt.registerTask('default', ['simplemocha']); + grunt.registerTask('coverage', 'Run Istanbul code test coverage task', ['mocha_istanbul']); +}; + diff --git a/package.json b/package.json index 122fb2a..62b803d 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,13 @@ "minimist": "1.2.0", "colors": "1.1.2" }, + "devDependencies": { + "grunt": "1.0.1", + "grunt-simple-mocha": "0.4.1", + "grunt-mocha-istanbul": "5.0.2", + "should": "13.1.3", + "del": "3.0.0" + }, "bin": { "node-red-nodegen": "./bin/node-red-nodegen.js" } From 899599c2c763b0a01b322294ae66276a4dc13edd Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Thu, 21 Dec 2017 04:06:27 +0000 Subject: [PATCH 2/3] Empty commit to run travis From e3705dd5ad6167930ac8c13cb66fc32f7e9d0376 Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Thu, 21 Dec 2017 04:09:23 +0000 Subject: [PATCH 3/3] Empty commit to run travis