Skip to content

Commit 385f986

Browse files
committed
Merge tag '2.0.0-alpha.2' into develop
v2.0.0-alpha.2
2 parents 807bb49 + b4958d6 commit 385f986

File tree

8 files changed

+99
-18
lines changed

8 files changed

+99
-18
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## v2.0.0-alpha.2 - 2024.04.16
10+
11+
### Fixed
12+
13+
- Fix usage with the `-c` flag ([741f758](https://github.com/studiometa/prettier-formatter-gitlab/commit/741f758))
14+
915
## v2.0.0-alpha.1 - 2024.04.16
1016

1117
### Added

bin/cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { prettierFormatterGitLab } from '../src/index.js';
55
const cmd = process.argv[2];
66

77
if (cmd) {
8-
exec(cmd, async (error, stdout) => {
8+
exec(cmd, async (error, stdout, stderr) => {
99
if (error) {
1010
console.log(error.message);
11-
await prettierFormatterGitLab(stdout);
11+
await prettierFormatterGitLab(stderr || stdout);
1212
process.exit(1);
1313
}
1414
});

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/prettier-formatter-gitlab",
3-
"version": "2.0.0-alpha.1",
3+
"version": "2.0.0-alpha.2",
44
"description": "A Prettier formatter for the GitLab Code Quality report",
55
"main": "src/index.js",
66
"type": "module",

test/__snapshots__/cli.spec.js.snap

+69-8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ exports[`prettier-formatter-gitlab cli should create a code quality report file
77
"check_name": "prettier",
88
"description": "Replace ·arg·· with arg",
99
"severity": "minor",
10-
"fingerprint": "952f33d5a4e20ba44bdffbb78bd0ff2d",
10+
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
1111
"location": {
12-
"path": "test/dirty-2.js",
12+
"path": "test/__stubs__/dirty-2.js",
1313
"lines": {
1414
"begin": 3,
1515
"end": 3
@@ -21,9 +21,9 @@ exports[`prettier-formatter-gitlab cli should create a code quality report file
2121
"check_name": "prettier",
2222
"description": "Insert ;",
2323
"severity": "minor",
24-
"fingerprint": "9b44d13de7085110ed75a839caff11f8",
24+
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
2525
"location": {
26-
"path": "test/dirty-2.js",
26+
"path": "test/__stubs__/dirty-2.js",
2727
"lines": {
2828
"begin": 5,
2929
"end": 5
@@ -35,9 +35,9 @@ exports[`prettier-formatter-gitlab cli should create a code quality report file
3535
"check_name": "prettier",
3636
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
3737
"severity": "minor",
38-
"fingerprint": "a6bd2d728de4fe92fd124e0377f606ff",
38+
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
3939
"location": {
40-
"path": "test/dirty.js",
40+
"path": "test/__stubs__/dirty.js",
4141
"lines": {
4242
"begin": 3,
4343
"end": 11
@@ -49,9 +49,70 @@ exports[`prettier-formatter-gitlab cli should create a code quality report file
4949
"check_name": "prettier",
5050
"description": "Delete ⏎⏎⏎",
5151
"severity": "minor",
52-
"fingerprint": "9c9ce209fdb82e60d0a2afb93a929fe9",
52+
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
5353
"location": {
54-
"path": "test/dirty.js",
54+
"path": "test/__stubs__/dirty.js",
55+
"lines": {
56+
"begin": 12,
57+
"end": 15
58+
}
59+
}
60+
}
61+
]"
62+
`;
63+
64+
exports[`prettier-formatter-gitlab cli should create a code quality report file 2`] = `
65+
"[
66+
{
67+
"type": "issue",
68+
"check_name": "prettier",
69+
"description": "Replace ·arg·· with arg",
70+
"severity": "minor",
71+
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
72+
"location": {
73+
"path": "test/__stubs__/dirty-2.js",
74+
"lines": {
75+
"begin": 3,
76+
"end": 3
77+
}
78+
}
79+
},
80+
{
81+
"type": "issue",
82+
"check_name": "prettier",
83+
"description": "Insert ;",
84+
"severity": "minor",
85+
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
86+
"location": {
87+
"path": "test/__stubs__/dirty-2.js",
88+
"lines": {
89+
"begin": 5,
90+
"end": 5
91+
}
92+
}
93+
},
94+
{
95+
"type": "issue",
96+
"check_name": "prettier",
97+
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
98+
"severity": "minor",
99+
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
100+
"location": {
101+
"path": "test/__stubs__/dirty.js",
102+
"lines": {
103+
"begin": 3,
104+
"end": 11
105+
}
106+
}
107+
},
108+
{
109+
"type": "issue",
110+
"check_name": "prettier",
111+
"description": "Delete ⏎⏎⏎",
112+
"severity": "minor",
113+
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
114+
"location": {
115+
"path": "test/__stubs__/dirty.js",
55116
"lines": {
56117
"begin": 12,
57118
"end": 15
File renamed without changes.
File renamed without changes.

test/cli.spec.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ describe('prettier-formatter-gitlab cli', () => {
1515
it('should create a code quality report file', () => {
1616
try {
1717
execSync(
18-
`PRETTIER_CODE_QUALITY_REPORT="${CODE_QUALITY_FILENAME}" ./bin/cli.js "prettier -l test"`,
18+
`PRETTIER_CODE_QUALITY_REPORT="${CODE_QUALITY_FILENAME}" ./bin/cli.js "prettier -l test/__stubs__/"`,
19+
);
20+
} catch (err) {
21+
// Silence is golden.
22+
}
23+
24+
expect(existsSync(CODE_QUALITY_FILENAME)).toBe(true);
25+
const content = readFileSync(CODE_QUALITY_FILENAME);
26+
expect(content.toString()).toMatchSnapshot();
27+
});
28+
29+
it('should create a code quality report file', () => {
30+
try {
31+
execSync(
32+
`PRETTIER_CODE_QUALITY_REPORT="${CODE_QUALITY_FILENAME}" ./bin/cli.js "prettier -c test/__stubs__/"`,
1933
);
2034
} catch (err) {
2135
// Silence is golden.
@@ -33,14 +47,14 @@ describe('prettier-formatter-gitlab cli', () => {
3347

3448
// prettier -c path/to/folder/
3549
const outputCheck = `Checking formatting...
36-
[warn] test/dirty-2.js
37-
[warn] test/dirty.js
50+
[warn] test/__stubs__/dirty-2.js
51+
[warn] test/__stubs__/dirty.js
3852
[warn] Code style issues found in 3 files. Run Prettier to fix.
3953
`;
4054

4155
// prettier -l path/to/folder/
42-
const outputList = `test/dirty-2.js
43-
test/dirty.js
56+
const outputList = `test/__stubs__/dirty-2.js
57+
test/__stubs__/dirty.js
4458
`;
4559

4660
await prettierFormatterGitLab(outputCheck);

0 commit comments

Comments
 (0)