Skip to content

Commit 0a52c19

Browse files
committed
Made gulp run TS declaration tests
And updated corresponding npm script: `run-ts-declaration-tests`. It is now part of gulp's `test` task.
1 parent 61fde2c commit 0a52c19

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

gulpfile.babel.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var os = require('os');
4747
var file = require('gulp-file');
4848
var semver = require('semver');
4949
var sharedNeo4j = require('./test/internal/shared-neo4j').default;
50+
var ts = require('gulp-typescript');
5051

5152
/**
5253
* Useful to investigate resource leaks in tests. Enable to see active sockets and file handles after the 'test' task.
@@ -154,8 +155,8 @@ gulp.task('install-driver-into-sandbox', ['nodejs'], function(){
154155
.pipe(install());
155156
});
156157

157-
gulp.task('test', function(cb){
158-
runSequence('test-nodejs', 'test-browser', 'run-tck', function (err) {
158+
gulp.task('test', function (cb) {
159+
runSequence('run-ts-declaration-tests', 'test-nodejs', 'test-browser', 'run-tck', function (err) {
159160
if (err) {
160161
var exitCode = 2;
161162
console.log('[FAIL] test task failed - exiting with code ' + exitCode);
@@ -256,6 +257,29 @@ gulp.task('run-stress-tests', function () {
256257
})).on('end', logActiveNodeHandles);
257258
});
258259

260+
gulp.task('run-ts-declaration-tests', function () {
261+
var failed = false;
262+
263+
return gulp.src(['test/types/**/*', 'types/**/*'], {base: '.'})
264+
.pipe(ts({
265+
module: 'es6',
266+
target: 'es6',
267+
noImplicitAny: true,
268+
noImplicitReturns: true,
269+
strictNullChecks: true,
270+
}))
271+
.on('error', function () {
272+
failed = true;
273+
})
274+
.on('finish', function () {
275+
if (failed) {
276+
console.log('[ERROR] TypeScript declarations contain errors. Exiting...');
277+
process.exit(1);
278+
}
279+
})
280+
.pipe(gulp.dest('build/test/types'));
281+
});
282+
259283
function logActiveNodeHandles() {
260284
if (enableActiveNodeHandlesLogging) {
261285
console.log('-- Active NodeJS handles START\n', process._getActiveHandles(), '\n-- Active NodeJS handles END');

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"stop-neo4j": "gulp stop-neo4j",
1717
"run-stress-tests": "gulp run-stress-tests",
1818
"run-tck": "gulp run-tck",
19-
"test-types": "tsc -p ./test/types/tsconfig.json",
19+
"run-ts-declaration-tests": "gulp run-ts-declaration-tests",
2020
"docs": "esdoc -c esdoc.json",
2121
"versionRelease": "gulp set --version $VERSION && npm version $VERSION --no-git-tag-version"
2222
},
@@ -49,6 +49,7 @@
4949
"gulp-jasmine-browser": "^0.2.3",
5050
"gulp-replace": "^0.5.4",
5151
"gulp-shell": "^0.4.3",
52+
"gulp-typescript": "^3.1.7",
5253
"gulp-uglify": "^1.4.2",
5354
"gulp-util": "^3.0.6",
5455
"gulp-watch": "^4.3.5",

test/types/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)