From fa39965a37ad68a32371d851d2ee92879ea803f0 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 15 Sep 2016 21:08:34 +0200 Subject: [PATCH] build(gulp): fail on ddescribe / iit left in tests Closes #10524 --- gulpfile.js | 16 +++++++++++++--- npm-shrinkwrap.clean.json | 16 +++++++++++++++- npm-shrinkwrap.json | 24 +++++++++++++++++++++++- package.json | 1 + 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 71415a21ac..3508d708be 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -84,7 +84,7 @@ gulp.task('public-api:enforce', (done) => { childProcess .spawn( - path.join(__dirname, pfScriptPath(`/node_modules/.bin/ts-api-guardian`)), + path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)), ['--verifyDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'}) .on('close', (errorCode) => { if (errorCode !== 0) { @@ -102,13 +102,23 @@ gulp.task('public-api:update', ['build.sh'], (done) => { childProcess .spawn( - path.join(__dirname, pfScriptPath(`/node_modules/.bin/ts-api-guardian`)), + path.join(__dirname, platformScriptPath(`/node_modules/.bin/ts-api-guardian`)), ['--outDir', publicApiDir].concat(publicApiArgs), {stdio: 'inherit'}) .on('close', done); }); +// Checks tests for presence of ddescribe, fdescribe, fit, iit and fails the build if one of the focused tests is found. +// Currently xdescribe and xit are _not_ reported as errors since there are a couple of excluded tests in our code base. +gulp.task('check-tests', function() { + const ddescribeIit = require('gulp-ddescribe-iit'); + return gulp.src([ + 'modules/**/*.spec.ts', + 'modules/**/*_spec.ts', + ]).pipe(ddescribeIit({allowDisabledTests: true})); +}); + // Check the coding standards and programming errors -gulp.task('lint', [ 'format:enforce', 'tools:build'], () => { +gulp.task('lint', ['check-tests', 'format:enforce', 'tools:build'], () => { const tslint = require('gulp-tslint'); // Built-in rules are at // https://github.com/palantir/tslint#supported-rules diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index fd85e171c3..bd9a42b1e9 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -2666,6 +2666,20 @@ } } }, + "gulp-ddescribe-iit": { + "version": "1.3.0", + "dependencies": { + "isarray": { + "version": "1.0.0" + }, + "readable-stream": { + "version": "2.0.6" + }, + "through2": { + "version": "2.0.1" + } + } + }, "gulp-diff": { "version": "1.0.0", "dependencies": { @@ -4671,5 +4685,5 @@ } }, "name": "angular-srcs", - "version": "2.0.0-rc.7" + "version": "2.0.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index a238427c8e..a446ecea43 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "angular-srcs", - "version": "2.0.0-rc.7", + "version": "2.0.0", "dependencies": { "@types/angularjs": { "version": "1.5.13-alpha", @@ -4216,6 +4216,28 @@ } } }, + "gulp-ddescribe-iit": { + "version": "1.3.0", + "from": "gulp-ddescribe-iit@latest", + "resolved": "https://registry.npmjs.org/gulp-ddescribe-iit/-/gulp-ddescribe-iit-1.3.0.tgz", + "dependencies": { + "isarray": { + "version": "1.0.0", + "from": "isarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "readable-stream": { + "version": "2.0.6", + "from": "readable-stream@>=2.0.0 <2.1.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" + }, + "through2": { + "version": "2.0.1", + "from": "through2@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.1.tgz" + } + } + }, "gulp-diff": { "version": "1.0.0", "from": "gulp-diff@>=1.0.0 <2.0.0", diff --git a/package.json b/package.json index 860fb33c24..f8cacb37e6 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "gulp-clang-format": "^1.0.23", "gulp-connect": "^2.3.1", "gulp-conventional-changelog": "^1.1.0", + "gulp-ddescribe-iit": "^1.3.0", "gulp-tslint": "^6.1.1", "incremental-dom": "^0.4.1", "jasmine": "^2.4.1",