11import { cp , readFile , rename } from 'node:fs/promises' ;
2- import { dirname , join } from 'node:path' ;
2+ import path from 'node:path' ;
33import { fileURLToPath } from 'node:url' ;
44import {
55 type DiffResult ,
@@ -26,21 +26,21 @@ import {
2626} from '@code-pushup/test-utils' ;
2727
2828describe ( 'CI package' , ( ) => {
29- const fixturesDir = join (
30- fileURLToPath ( dirname ( import . meta. url ) ) ,
29+ const fixturesDir = path . join (
30+ fileURLToPath ( path . dirname ( import . meta. url ) ) ,
3131 '..' ,
3232 'mocks' ,
3333 'fixtures' ,
3434 'ci-test-repo' ,
3535 ) ;
36- const ciSetupRepoDir = join (
36+ const ciSetupRepoDir = path . join (
3737 process . cwd ( ) ,
3838 E2E_ENVIRONMENTS_DIR ,
3939 nxTargetProject ( ) ,
4040 TEST_OUTPUT_DIR ,
4141 'ci-test-repo' ,
4242 ) ;
43- const outputDir = join ( ciSetupRepoDir , '.code-pushup' ) ;
43+ const outputDir = path . join ( ciSetupRepoDir , '.code-pushup' ) ;
4444
4545 const options = {
4646 directory : ciSetupRepoDir ,
@@ -91,14 +91,14 @@ describe('CI package', () => {
9191 report : {
9292 rootDir : outputDir ,
9393 files : [
94- join ( outputDir , 'report.json' ) ,
95- join ( outputDir , 'report.md' ) ,
94+ path . join ( outputDir , 'report.json' ) ,
95+ path . join ( outputDir , 'report.md' ) ,
9696 ] ,
9797 } ,
9898 } ,
9999 } satisfies RunResult ) ;
100100
101- const jsonPromise = readFile ( join ( outputDir , 'report.json' ) , 'utf8' ) ;
101+ const jsonPromise = readFile ( path . join ( outputDir , 'report.json' ) , 'utf8' ) ;
102102 await expect ( jsonPromise ) . resolves . toBeTruthy ( ) ;
103103 const report = JSON . parse ( await jsonPromise ) as Report ;
104104 expect ( report ) . toEqual (
@@ -138,8 +138,8 @@ describe('CI package', () => {
138138 await git . checkoutLocalBranch ( 'feature-1' ) ;
139139
140140 await rename (
141- join ( ciSetupRepoDir , 'index.js' ) ,
142- join ( ciSetupRepoDir , 'index.ts' ) ,
141+ path . join ( ciSetupRepoDir , 'index.js' ) ,
142+ path . join ( ciSetupRepoDir , 'index.ts' ) ,
143143 ) ;
144144
145145 await git . add ( 'index.ts' ) ;
@@ -160,26 +160,29 @@ describe('CI package', () => {
160160 report : {
161161 rootDir : outputDir ,
162162 files : [
163- join ( outputDir , 'report.json' ) ,
164- join ( outputDir , 'report.md' ) ,
163+ path . join ( outputDir , 'report.json' ) ,
164+ path . join ( outputDir , 'report.md' ) ,
165165 ] ,
166166 } ,
167167 diff : {
168168 rootDir : outputDir ,
169169 files : [
170- join ( outputDir , 'report-diff.json' ) ,
171- join ( outputDir , 'report-diff.md' ) ,
170+ path . join ( outputDir , 'report-diff.json' ) ,
171+ path . join ( outputDir , 'report-diff.md' ) ,
172172 ] ,
173173 } ,
174174 } ,
175175 } satisfies RunResult ) ;
176176
177- const mdPromise = readFile ( join ( outputDir , 'report-diff.md' ) , 'utf8' ) ;
177+ const mdPromise = readFile (
178+ path . join ( outputDir , 'report-diff.md' ) ,
179+ 'utf8' ,
180+ ) ;
178181 await expect ( mdPromise ) . resolves . toBeTruthy ( ) ;
179182 const md = await mdPromise ;
180183 await expect (
181184 md . replace ( / [ \d a - f ] { 40 } / g, '`<commit-sha>`' ) ,
182- ) . toMatchFileSnapshot ( join ( TEST_SNAPSHOTS_DIR , 'report-diff.md' ) ) ;
185+ ) . toMatchFileSnapshot ( path . join ( TEST_SNAPSHOTS_DIR , 'report-diff.md' ) ) ;
183186 } ) ;
184187 } ) ;
185188} ) ;
0 commit comments