From ccecefb25d3f873cb4dd42d6cc30d0b130493d2f Mon Sep 17 00:00:00 2001 From: Daniel Tonon Date: Tue, 29 Sep 2020 22:59:51 +1000 Subject: [PATCH 1/2] Making a failing autoload-ts test --- test/config-flags-gulpfile.js | 23 +++++++++++++++++++ .../flags/gulpfile/autoload-ts/.gulp.json | 5 ++++ .../other_folder/gulpfile-exports.ts | 6 +++++ 3 files changed, 34 insertions(+) create mode 100644 test/fixtures/config/flags/gulpfile/autoload-ts/.gulp.json create mode 100644 test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts diff --git a/test/config-flags-gulpfile.js b/test/config-flags-gulpfile.js index 3ac37ac1..5ad3d02f 100644 --- a/test/config-flags-gulpfile.js +++ b/test/config-flags-gulpfile.js @@ -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); + } + }); + }); diff --git a/test/fixtures/config/flags/gulpfile/autoload-ts/.gulp.json b/test/fixtures/config/flags/gulpfile/autoload-ts/.gulp.json new file mode 100644 index 00000000..0b95aaa2 --- /dev/null +++ b/test/fixtures/config/flags/gulpfile/autoload-ts/.gulp.json @@ -0,0 +1,5 @@ +{ + "flags": { + "gulpfile": "other_folder/gulpfile-exports.ts" + } +} diff --git a/test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts b/test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts new file mode 100644 index 00000000..773b8206 --- /dev/null +++ b/test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts @@ -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); From 03731548d55ae5e12cb2860a556828fa8ba49c68 Mon Sep 17 00:00:00 2001 From: Daniel Tonon Date: Sun, 25 Oct 2020 19:04:37 +1100 Subject: [PATCH 2/2] Using a "." in the middle of the custom ts gulp file name This replicates the issue that I am having --- package.json | 7 +++++-- .../{gulpfile-exports.ts => gulpfile.exports.ts} | 0 2 files changed, 5 insertions(+), 2 deletions(-) rename test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/{gulpfile-exports.ts => gulpfile.exports.ts} (100%) diff --git a/package.json b/package.json index bed47c0f..52528812 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts b/test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile.exports.ts similarity index 100% rename from test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile-exports.ts rename to test/fixtures/config/flags/gulpfile/autoload-ts/other_folder/gulpfile.exports.ts