Skip to content

Commit c3dba49

Browse files
grantcoxricardogobbosouza
authored andcommitted
fix: output report generation
1 parent 32ffaed commit c3dba49

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/linter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ function linter(key, options, compilation) {
152152
return;
153153
}
154154

155-
const content = outputReport.formatter;
156-
(await loadFormatter(stylelint, outputReport.formatter))(
157-
results,
158-
returnValue,
159-
);
160-
formatter(results, returnValue);
155+
const content = outputReport.formatter
156+
? (await loadFormatter(stylelint, outputReport.formatter))(
157+
results,
158+
returnValue,
159+
)
160+
: formatter(results, returnValue);
161161

162162
let { filePath } = outputReport;
163163
if (!isAbsolute(filePath)) {

test/output-report.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { join } from 'path';
22

3-
import { existsSync } from 'fs-extra';
3+
import { existsSync, readFileSync } from 'fs-extra';
44

55
import pack from './utils/pack';
66

@@ -28,5 +28,8 @@ describe('output report', () => {
2828
expect(stats.hasWarnings()).toBe(false);
2929
expect(stats.hasErrors()).toBe(true);
3030
expect(existsSync(filePath)).toBe(true);
31+
expect(JSON.parse(readFileSync(filePath, 'utf8'))).toMatchObject([
32+
{ source: expect.stringContaining('error/test.scss') },
33+
]);
3134
});
3235
});

0 commit comments

Comments
 (0)