Loading .jshintrc +5 −2 Original line number Diff line number Diff line Loading @@ -80,12 +80,15 @@ "rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. "wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. // Additional globals introduced by Mocha // Additional globals introduced by Mocha and Chai "globals": { "describe" : false, "xdescribe" : false, "it" : false, "xit" : false, "before" : false, "after" : false, "expect" : false, "Promise" : true // See: https://github.com/jshint/jshint/issues/1747 }, Loading gulpfile.js +12 −5 Original line number Diff line number Diff line Loading @@ -9,11 +9,16 @@ var mocha = require('gulp-mocha'); var chalk = require('chalk'); var rimraf = require('rimraf'); var chai = require("chai"); chai.use(require("chai-as-promised")); global.expect = chai.expect; var paths = { libJsFiles: './lib/**/*.js', gulpfile: './gulpfile.js', specFiles: './test/**/*.js' specFiles: './test/spec/**/*.js', fixtureFiles: './test/fixtures/**/*.js' }; Loading @@ -24,7 +29,8 @@ gulp.task('watch', function () { return gulp.watch([ paths.libJsFiles, paths.gulpfile, paths.specFiles paths.specFiles, paths.fixtureFiles ], [ 'validate' ]); Loading @@ -37,7 +43,7 @@ gulp.task('validate', function (done) { gulp.task('lint', function () { return gulp.src([paths.libJsFiles, paths.gulpfile, paths.specFiles]) return gulp.src([paths.libJsFiles, paths.gulpfile, paths.specFiles, paths.fixtureFiles]) .pipe(jshint()) .pipe(jshint.reporter(jshintStylish)) .pipe(jshint.reporter('fail')); Loading @@ -56,8 +62,9 @@ gulp.task('test', ['clean'], function (done) { gulp.src(paths.specFiles) .pipe(mocha()) .on('error', function () { console.log(chalk.bold.bgRed(' TESTS FAILED ')); .on('error', function (err) { console.error(String(err)); console.error(chalk.bold.bgRed(' TESTS FAILED ')); done(); }) .pipe(istanbul.writeReports({ Loading package.json +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ "request": "^2.34" }, "devDependencies": { "chai": "^1.9.2", "chai-as-promised": "^4.1.1", "chalk": "^0.5.1", "gulp": "^3.8.8", "gulp-istanbul": "^0.3.1", Loading test/fixtures/require/afterwards.js 0 → 100644 +9 −0 Original line number Diff line number Diff line 'use strict'; var rp = require('../../../lib/rp.js'); var request = require('request'); var rpHasThen = rp('http://localhost:4000/200').then !== undefined; var requestHasNoThen = request('http://localhost:4000/200').then === undefined; console.log('rp: ' + rpHasThen + ', request: ' + requestHasNoThen); test/fixtures/require/beforehand.js 0 → 100644 +9 −0 Original line number Diff line number Diff line 'use strict'; var request = require('request'); var rp = require('../../../lib/rp.js'); var requestHasNoThen = request('http://localhost:4000/200').then === undefined; var rpHasThen = rp('http://localhost:4000/200').then !== undefined; console.log('request: ' + requestHasNoThen + ', rp: ' + rpHasThen); Loading
.jshintrc +5 −2 Original line number Diff line number Diff line Loading @@ -80,12 +80,15 @@ "rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. "wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. // Additional globals introduced by Mocha // Additional globals introduced by Mocha and Chai "globals": { "describe" : false, "xdescribe" : false, "it" : false, "xit" : false, "before" : false, "after" : false, "expect" : false, "Promise" : true // See: https://github.com/jshint/jshint/issues/1747 }, Loading
gulpfile.js +12 −5 Original line number Diff line number Diff line Loading @@ -9,11 +9,16 @@ var mocha = require('gulp-mocha'); var chalk = require('chalk'); var rimraf = require('rimraf'); var chai = require("chai"); chai.use(require("chai-as-promised")); global.expect = chai.expect; var paths = { libJsFiles: './lib/**/*.js', gulpfile: './gulpfile.js', specFiles: './test/**/*.js' specFiles: './test/spec/**/*.js', fixtureFiles: './test/fixtures/**/*.js' }; Loading @@ -24,7 +29,8 @@ gulp.task('watch', function () { return gulp.watch([ paths.libJsFiles, paths.gulpfile, paths.specFiles paths.specFiles, paths.fixtureFiles ], [ 'validate' ]); Loading @@ -37,7 +43,7 @@ gulp.task('validate', function (done) { gulp.task('lint', function () { return gulp.src([paths.libJsFiles, paths.gulpfile, paths.specFiles]) return gulp.src([paths.libJsFiles, paths.gulpfile, paths.specFiles, paths.fixtureFiles]) .pipe(jshint()) .pipe(jshint.reporter(jshintStylish)) .pipe(jshint.reporter('fail')); Loading @@ -56,8 +62,9 @@ gulp.task('test', ['clean'], function (done) { gulp.src(paths.specFiles) .pipe(mocha()) .on('error', function () { console.log(chalk.bold.bgRed(' TESTS FAILED ')); .on('error', function (err) { console.error(String(err)); console.error(chalk.bold.bgRed(' TESTS FAILED ')); done(); }) .pipe(istanbul.writeReports({ Loading
package.json +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ "request": "^2.34" }, "devDependencies": { "chai": "^1.9.2", "chai-as-promised": "^4.1.1", "chalk": "^0.5.1", "gulp": "^3.8.8", "gulp-istanbul": "^0.3.1", Loading
test/fixtures/require/afterwards.js 0 → 100644 +9 −0 Original line number Diff line number Diff line 'use strict'; var rp = require('../../../lib/rp.js'); var request = require('request'); var rpHasThen = rp('http://localhost:4000/200').then !== undefined; var requestHasNoThen = request('http://localhost:4000/200').then === undefined; console.log('rp: ' + rpHasThen + ', request: ' + requestHasNoThen);
test/fixtures/require/beforehand.js 0 → 100644 +9 −0 Original line number Diff line number Diff line 'use strict'; var request = require('request'); var rp = require('../../../lib/rp.js'); var requestHasNoThen = request('http://localhost:4000/200').then === undefined; var rpHasThen = rp('http://localhost:4000/200').then !== undefined; console.log('request: ' + requestHasNoThen + ', rp: ' + rpHasThen);