11import path from 'node:path'
2- import fs from 'node:fs/promises'
3- import os from 'node:os'
4- import { describe , it , expect , beforeEach , afterEach } from 'vitest'
2+ import { describe , it , expect } from 'vitest'
53
64import {
75 pathToPosix ,
@@ -34,8 +32,6 @@ describe('util', () => {
3432 } )
3533
3634 describe ( 'getAutoIncludes()' , ( ) => {
37- let tmpDir : string
38-
3935 const makePm = ( name : string ) : PackageManager => ( {
4036 name,
4137 representativeLockfile : undefined ,
@@ -46,46 +42,28 @@ describe('util', () => {
4642 detector : ( ) => ( { } ) as any ,
4743 } )
4844
49- beforeEach ( async ( ) => {
50- tmpDir = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , 'checkly-test-' ) )
51- } )
52-
53- afterEach ( async ( ) => {
54- await fs . rm ( tmpDir , { recursive : true , force : true } )
55- } )
56-
57- it ( 'should return patches/** when pnpm and patches dir exists' , async ( ) => {
58- await fs . mkdir ( path . join ( tmpDir , 'patches' ) )
59- const result = getAutoIncludes ( tmpDir , makePm ( 'pnpm' ) , [ ] )
45+ it ( 'should return patches/** for pnpm' , ( ) => {
46+ const result = getAutoIncludes ( makePm ( 'pnpm' ) , [ ] )
6047 expect ( result ) . toEqual ( [ 'patches/**' ] )
6148 } )
6249
63- it ( 'should return empty when pnpm but no patches dir' , ( ) => {
64- const result = getAutoIncludes ( tmpDir , makePm ( 'pnpm' ) , [ ] )
65- expect ( result ) . toEqual ( [ ] )
66- } )
67-
68- it ( 'should return empty for npm even with patches dir' , async ( ) => {
69- await fs . mkdir ( path . join ( tmpDir , 'patches' ) )
70- const result = getAutoIncludes ( tmpDir , makePm ( 'npm' ) , [ ] )
50+ it ( 'should return empty for npm' , ( ) => {
51+ const result = getAutoIncludes ( makePm ( 'npm' ) , [ ] )
7152 expect ( result ) . toEqual ( [ ] )
7253 } )
7354
74- it ( 'should return empty for yarn even with patches dir' , async ( ) => {
75- await fs . mkdir ( path . join ( tmpDir , 'patches' ) )
76- const result = getAutoIncludes ( tmpDir , makePm ( 'yarn' ) , [ ] )
55+ it ( 'should return empty for yarn' , ( ) => {
56+ const result = getAutoIncludes ( makePm ( 'yarn' ) , [ ] )
7757 expect ( result ) . toEqual ( [ ] )
7858 } )
7959
80- it ( 'should skip when user already includes patches/**' , async ( ) => {
81- await fs . mkdir ( path . join ( tmpDir , 'patches' ) )
82- const result = getAutoIncludes ( tmpDir , makePm ( 'pnpm' ) , [ 'patches/**' ] )
60+ it ( 'should skip when user already includes patches/**' , ( ) => {
61+ const result = getAutoIncludes ( makePm ( 'pnpm' ) , [ 'patches/**' ] )
8362 expect ( result ) . toEqual ( [ ] )
8463 } )
8564
86- it ( 'should skip when user already includes a patches/ subpath' , async ( ) => {
87- await fs . mkdir ( path . join ( tmpDir , 'patches' ) )
88- const result = getAutoIncludes ( tmpDir , makePm ( 'pnpm' ) , [ 'patches/some-patch.patch' ] )
65+ it ( 'should skip when user already includes a patches/ subpath' , ( ) => {
66+ const result = getAutoIncludes ( makePm ( 'pnpm' ) , [ 'patches/some-patch.patch' ] )
8967 expect ( result ) . toEqual ( [ ] )
9068 } )
9169 } )
0 commit comments