-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathgithub.test.mjs
More file actions
26 lines (21 loc) · 875 Bytes
/
github.test.mjs
File metadata and controls
26 lines (21 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { describe, it } from 'node:test';
import github from '../../reporters/github.mjs';
import assert from 'node:assert';
import { errorIssue, infoIssue, warnIssue } from '../fixtures/issues.mjs';
describe('github', () => {
it('should write to stdout with the correct fn based on the issue level', t => {
t.mock.method(process.stdout, 'write');
github(infoIssue);
github(warnIssue);
github(errorIssue);
assert.strictEqual(process.stdout.write.mock.callCount(), 3);
const callsArgs = process.stdout.write.mock.calls.map(call =>
call.arguments[0].trim()
);
assert.deepStrictEqual(callsArgs, [
'::notice file=doc/api/test.md::This is a INFO issue',
'::warning file=doc/api/test.md,line=1,endLine=1::This is a WARN issue',
'::error file=doc/api/test.md,line=1,endLine=1::This is a ERROR issue',
]);
});
});