diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..0524503 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,10 @@ +engines: + csslint: + enabled: true + eslint: + enabled: true + fixme: + enabled: true +ratings: + paths: + - "src/**" \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d89d4a1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: node_js + +node_js: + - "4.1" + - "4.0" + - "0.12" + - "0.11" + +cache: + directories: + - node_modules + +before_install: + - npm i -g npm@^3.3.0 + +script: + - npm run-script test \ No newline at end of file diff --git a/README.md b/README.md index 56b98fa..3680718 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # GitHub Extended -[GitHub Extended](https://github.com/AurelioDeRosa/github-extended) is a collection of methods to extend the +[![Code Climate](https://codeclimate.com/github/github-tools/github-extended/badges/gpa.svg)](https://codeclimate.com/github/github-tools/github-extended) +[![Build Status](https://travis-ci.org/github-tools/github-extended.svg?branch=master)](https://travis-ci.org/github-tools/github-extended) +[![Coverage Status](https://coveralls.io/repos/github-tools/github-extended/badge.svg?branch=master&service=github)](https://coveralls.io/github/github-tools/github-extended?branch=master) + +[GitHub Extended](https://github.com/github-tools/github-extended) is a collection of methods to extend the functionality of [Github.js](https://github.com/michael/github) (known on [npm](https://www.npmjs.com) as [github-api](https://www.npmjs.com/package/github-api)). @@ -8,7 +12,7 @@ functionality of [Github.js](https://github.com/michael/github) (known on [npm]( Being an extension for Github.js, the only requirement is to install and include [Github.js](https://github.com/michael/github) before -[GitHub Extended](https://github.com/AurelioDeRosa/github-extended). +[GitHub Extended](https://github.com/github-tools/github-extended). ## Installation @@ -48,7 +52,7 @@ Creates a fork of the repository ## License -[GitHub Extended](https://github.com/AurelioDeRosa/github-extended) is dual licensed under +[GitHub Extended](https://github.com/github-tools/github-extended) is dual licensed under [MIT](http://www.opensource.org/licenses/MIT) and [GPL-3.0](http://opensource.org/licenses/GPL-3.0). ## Author diff --git a/karma.conf.js b/karma.conf.js index 09c2da3..6b56b68 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,12 +1,17 @@ 'use strict'; +var browserifyIstanbul = require('browserify-istanbul'); +var isparta = require('isparta'); + module.exports = function(config) { config.set({ browserify: { debug: true, transform: [ 'babelify', - 'browserify-istanbul' + browserifyIstanbul({ + istrumenter: isparta + }) ] }, browsers: ['PhantomJS'], @@ -19,8 +24,19 @@ module.exports = function(config) { } }, coverageReporter: { - type : 'html', - dir : 'coverage/' + dir: 'coverage', + reporters: [ + { + type: 'text-summary' + }, + { + type : 'html' + }, + { + type: 'lcovonly', + subdir: 'lcov' + } + ] }, files: [ 'node_modules/babel-polyfill/dist/polyfill.js', @@ -38,7 +54,8 @@ module.exports = function(config) { }, reporters: [ 'mocha', - 'coverage' + 'coverage', + 'coveralls' ], reportSlowerThan: 800, singleRun: true diff --git a/package.json b/package.json index 96cb47d..af69783 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "karma-chai": "^0.1.0", "karma-chai-as-promised": "^0.1.2", "karma-coverage": "git://github.com/douglasduteil/karma-coverage#next", + "karma-coveralls": "^1.1.2", "karma-mocha": "^0.2.1", "karma-mocha-reporter": "^1.1.3", "karma-phantomjs-launcher": "^0.2.1", diff --git a/test/spec/test.js b/test/spec/test.js index 90a9ccc..90ce23b 100644 --- a/test/spec/test.js +++ b/test/spec/test.js @@ -7,6 +7,18 @@ import testUser from '../fixtures/user.json'; describe('Github', () => { let github, repository, testRepositoryName; + /** + * Creates or update a file + * + * @param {Object} data The data to create or update the file + * @param {string} data.repository The repository to work with + * @param {string} data.branch The branch in which the file has to be created or updated + * @param {string} data.filename The full path of the file + * @param {string} data.content The content of the file + * @param {string} data.commitMessage The commit message to use + * + * @returns {Promise} + */ function promisifiedWrite(data) { return new Promise((resolve, reject) => { data.repository.write(data.branch, data.filename, data.content, data.commitMessage, error => { @@ -14,7 +26,10 @@ describe('Github', () => { reject(error); } - resolve(); + // Fixes an issue when writing multiple files in succession. + // This issue only happens in Travis CI. + // (http://stackoverflow.com/questions/19576601/github-api-issue-with-file-upload#comment29076073_19576601) + setTimeout(resolve, 500); }); }); } @@ -429,8 +444,8 @@ describe('Github', () => { }); describe('fork()', () => { - let forkUsername = 'AurelioDeRosa'; - let forkRepositoryName = 'HTML5-API-demos'; + let forkUsername = 'jquery'; + let forkRepositoryName = 'irc.jquery.org'; afterEach(done => { let fork = github.getRepo(testUser.username, forkRepositoryName);