1+ import { dirname } from 'knip/dist/util/path' ;
12import { join , relative } from 'node:path' ;
23import { afterEach , expect } from 'vitest' ;
34import { teardownTestFolder } from '@code-pushup/test-setup' ;
4- import { removeColorCodes } from '@code-pushup/test-utils' ;
5+ import { createNpmWorkspace , removeColorCodes } from '@code-pushup/test-utils' ;
56import { executeProcess , readJsonFile , readTextFile } from '@code-pushup/utils' ;
6- import { createNpmWorkspace } from '../mocks/create-npm-workshpace' ;
77
88describe ( 'create-cli-inti' , ( ) => {
99 const workspaceRoot = 'tmp/e2e/create-cli-e2e' ;
@@ -19,7 +19,12 @@ describe('create-cli-inti', () => {
1919 await createNpmWorkspace ( cwd ) ;
2020 const { code, stdout } = await executeProcess ( {
2121 command : 'npm' ,
22- args : [ 'exec' , '@code-pushup/create-cli' , `--userconfig=${ userconfig } ` ] ,
22+ args : [
23+ 'exec' ,
24+ '@code-pushup/create-cli' ,
25+ `--userconfig=${ userconfig } ` ,
26+ `--prefix=${ dirname ( userconfig ) } ` ,
27+ ] ,
2328 cwd,
2429 } ) ;
2530
@@ -48,16 +53,20 @@ describe('create-cli-inti', () => {
4853 ) ;
4954 } ) ;
5055
51- // eslint-disable-next-line vitest/no-disabled-tests
52- it . skip ( 'should execute package correctly over npm init' , async ( ) => {
56+ it ( 'should execute package correctly over npm init' , async ( ) => {
5357 const cwd = join ( baseDir , 'npm-init' ) ;
5458 const userconfig = relative ( cwd , join ( workspaceRoot , '.npmrc' ) ) ;
5559
5660 await createNpmWorkspace ( cwd ) ;
5761
5862 const { code, stdout } = await executeProcess ( {
5963 command : 'npm' ,
60- args : [ 'init' , '@code-pushup/cli' , `--userconfig=${ userconfig } ` ] ,
64+ args : [
65+ 'init' ,
66+ '@code-pushup/cli' ,
67+ `--userconfig=${ userconfig } ` ,
68+ `--prefix=${ dirname ( userconfig ) } ` ,
69+ ] ,
6170 cwd,
6271 } ) ;
6372
@@ -94,7 +103,12 @@ describe('create-cli-inti', () => {
94103
95104 await executeProcess ( {
96105 command : 'npm' ,
97- args : [ 'init' , '@code-pushup/cli' , `--userconfig=${ userconfig } ` ] ,
106+ args : [
107+ 'init' ,
108+ '@code-pushup/cli' ,
109+ `--userconfig=${ userconfig } ` ,
110+ `--prefix=${ dirname ( userconfig ) } ` ,
111+ ] ,
98112 cwd,
99113 } ) ;
100114
0 commit comments