Skip to content

Commit bb831e4

Browse files
committed
Add tests
1 parent 52ffa4b commit bb831e4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

test/__stubs__/.gitlab-ci.fail.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.ref:
2+
script:
3+
- npm run lint
4+
5+
prettier:
6+
script:
7+
- !reference [.ref, script]
8+
artifacts:
9+
reports:
10+
codequalit: gl-codequality.json
11+

test/utils/get-output-path.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,16 @@ describe('The getPrettierFileInfos function', () => {
1111
resolve(join(import.meta.dirname, '../__stubs__/gl-codequality.json')),
1212
);
1313
});
14+
15+
it('should throw an error if it can not find the report file path', () => {
16+
process.env.CI_PROJECT_DIR = resolve(join(import.meta.dirname, '../__stubs__/'));
17+
process.env.CI_JOB_NAME = 'prettier';
18+
process.env.CI_CONFIG_PATH = '.gitlab-ci.fail.yml';
19+
expect(getOutputPath).toThrow();
20+
});
21+
22+
it('should throw an error if it can not find a .gitlab-ci.yml file', () => {
23+
process.env.CI_PROJECT_DIR = '/tmp';
24+
expect(getOutputPath).toThrow();
25+
});
1426
});

0 commit comments

Comments
 (0)