Skip to content

Commit

Permalink
Fix: Revert displayName change from #53 & add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Dec 21, 2017
1 parent 61e4054 commit 672b8a8
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.babel.js
3 changes: 2 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"preset": "gulp"
"preset": "gulp",
"excludeFiles": ["**/*.babel.js"]
}
2 changes: 1 addition & 1 deletion lib/shared/registerExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function registerExports(gulpInst, tasks) {
return;
}

gulpInst.task(task.displayName || taskName, task);
gulpInst.task(taskName, task);
}
}

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"yargs": "^3.28.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"babel-register": "^6.5.1",
"code": "^1.2.1",
"coveralls": "^2.7.0",
"eslint": "^1.7.3",
Expand Down
7 changes: 7 additions & 0 deletions test/expected/tasks-as-exports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gulp-cli/test
├── build
├── clean
└─┬ dist
└─┬ <series>
├── clean
└── build
26 changes: 26 additions & 0 deletions test/exports-as-tasks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

var lab = exports.lab = require('lab').script();
var code = require('code');
var fs = require('fs');
var child = require('child_process');

var output = fs.readFileSync(__dirname + '/expected/tasks-as-exports.txt', 'utf8').replace(/(\r\n|\n|\r)/gm,'\n');

// Long timeout is required because parse time is slow
lab.experiment('exports as tasks', { timeout: 0 }, function() {

lab.test('prints the task list', function(done) {

child.exec('node ' + __dirname + '/../bin/gulp.js --tasks --gulpfile "./test/fixtures/gulpfile-exports.babel.js"', function(err, stdout) {
code.expect(stdout).to.contain('Tasks for');
stdout = stdout.replace(/\\/g, '/').split('Tasks for')[1].split('\n');
var outputArray = output.split('\n');
for (var i = 0; i < stdout.length; i++) {
code.expect(stdout[i]).to.contain(outputArray[i]);
}
done(err);
});
});

});
3 changes: 3 additions & 0 deletions test/fixtures/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
9 changes: 9 additions & 0 deletions test/fixtures/gulpfile-exports.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// jscs:disable

'use strict';

import gulp from 'gulp';

export function clean(){};
export function build(){};
export const dist = gulp.series(clean, build);

0 comments on commit 672b8a8

Please sign in to comment.