Skip to content

Commit eacf96c

Browse files
committed
Add tests
1 parent a937d55 commit eacf96c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/__stubs__/.gitlab-ci.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+
codequality: gl-codequality.json
11+

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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { describe, it, expect } from 'bun:test';
2+
import { resolve, join } from 'node:path';
3+
import { getOutputPath } from '../../src/utils/get-output-path.js';
4+
5+
describe('The getPrettierFileInfos function', () => {
6+
it('should return the output path defined in a .gitlab-ci.yml file', () => {
7+
process.env.CI_PROJECT_DIR = resolve(join(import.meta.dirname, '../__stubs__/'));
8+
process.env.CI_JOB_NAME = 'prettier';
9+
console.log(process.env.CI_PROJECT_DIR);
10+
expect(getOutputPath()).toBe(
11+
resolve(join(import.meta.dirname, '../__stubs__/gl-codequality.json')),
12+
);
13+
});
14+
});

0 commit comments

Comments
 (0)