Skip to content

Commit

Permalink
feat(scriptSuffixes): add behavior output scriptSuffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
59naga committed Apr 9, 2016
1 parent 04db197 commit 4476549
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lodash.flattendeep": "^4.1.0"
},
"scripts": {
"start": "abby test",
"start": "abby test --watch",
"test": "mocha --compilers js:babel-register",
"lint": "eslint src test",
"cover": "abby cover:test, cover:report --no-watch",
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ export default class Log extends Plugin {
}
return 'unknown';
});
this.output(`task start ${Log.strong(names)}.`);
const suffixes = this.getProps().scriptSuffixes || [];
let suffix = '';
if (suffixes.length) {
suffix = ` (with ${Log.strong(suffixes, ' ')})`;
}
this.output(`task start ${Log.strong(names)}.${suffix}`);

if (names.length > 1) {
this.subscribe('script-start', scriptStart);
Expand Down
36 changes: 36 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,42 @@ describe('Log', () => {
assert(message.match(/plugin enabled foo, bar, baz\.\n$/));
});
});

it('should be output the parent.props.scriptSuffixes(abigail#12)', () => {
const { log, emitter, process } = setupFixtures({ notifyPlugins: true });

const tasks = [
{
main: {
name: 'foo',
exitCode: 1,
},
},
{
main: {
name: 'bar',
exitCode: 2,
},
},
{
main: {
name: 'baz',
exitCode: 3,
},
},
];
log.setProps({
scriptSuffixes: ['beep', 'boop', 'kaboom'],
});

return emitter.emit('initialized')
.then(() => emitter.emit('attach-plugins'))
.then(() => emitter.emit('task-start', tasks))
.then(() => {
const output = stripAnsi(process.stdout.write.args[1][0]);
assert(output.match(/\+[ \d]+ms @_@ task start foo, bar, baz. \(with beep boop kaboom\)\n$/));
});
});
});

describe('detach-plugins', () => {
Expand Down

0 comments on commit 4476549

Please sign in to comment.