Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"pretest": "npm run lint",
"test": "mocha --async-only --timeout 5000 test/lib test",
"cover": "nyc --reporter=lcov --reporter=text-summary npm test",
"coveralls": "nyc --reporter=text-lcov npm test | coveralls"
"coveralls": "nyc --reporter=text-lcov npm test | coveralls",
"ts-test": "gulp --gulpfile test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile.exports.ts dist"
},
"dependencies": {
"ansi-colors": "^1.0.1",
Expand Down Expand Up @@ -63,7 +64,9 @@
"mocha": "^3.2.0",
"nyc": "^13.3.0",
"rimraf": "^2.6.1",
"semver": "^5.7.1"
"semver": "^5.7.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
},
"keywords": [
"build",
Expand Down
23 changes: 23 additions & 0 deletions test/config-flags-gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,28 @@ describe('config: flags.gulpfile', function() {
}
});

it('Should autoload ts-node/register for a specified TypeScript gulpfile', function(done) {
this.timeout(0);

runner
.chdir('flags/gulpfile/autoload-ts')
.gulp('dist')
.run(cb);

function cb(err, stdout, stderr) {
expect(err).toEqual(null);
expect(stderr).toEqual('');

var requiring = eraseTime(headLines(stdout, 1));
expect(requiring).toEqual('Requiring external module ts-node/register');
var clean = eraseTime(headLines(stdout, 1, 4));
expect(clean).toEqual('clean!');
var build = eraseTime(headLines(stdout, 1, 7));
expect(build).toEqual('build!');

done(err);
}
});

});

5 changes: 5 additions & 0 deletions test/fixtures/config/flags/gulpfile/autoload-ts/.gulp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"flags": {
"gulpfile": "other_folder/gulpfile-exports.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as gulp from 'gulp';

export function clean(done) { console.log('clean!'); done(); };
export function build(done) { console.log('build!'); done(); };
export const string = 'no function';
export const dist = gulp.series(clean, build);