Skip to content

Commit

Permalink
Check if message was created by devtools. Closes #32.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-eb committed Nov 7, 2016
1 parent 8b839b4 commit aae61a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/__tests__/index.js
Expand Up @@ -114,6 +114,17 @@ ava('should work with filenames', t => {
});
});

ava('should ignore unrelated messages', t => {
let processors = [
plugin(),
postcss.plugin('unrelated', () => (css, result) => result.warn('Unrelated message!', {node: result.root})),
];

return postcss(processors).process(fixture).then(result => {
t.deepEqual(result.messages.length, 2);
});
});

ava('should use the postcss plugin api', t => {
t.truthy(plugin().postcssVersion, 'should be able to access version');
t.deepEqual(plugin().postcssPlugin, name, 'should be able to access name');
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -26,6 +26,7 @@ function getMessage (plugin, completed, precise) {
text: `Completed in ${formatted}`,
time: convert(completed),
rawTime: completed,
_devtools: true,
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/formatter.js
Expand Up @@ -27,7 +27,7 @@ function createResultsTable (messages) {
}

export default function formatter (input) {
const output = createResultsTable(input.messages);
const output = createResultsTable(input.messages.filter(m => m._devtools));
return `${underline(logFrom(input.source))}\n${output}`;
};

Expand Down

0 comments on commit aae61a3

Please sign in to comment.