@@ -5,11 +5,11 @@ const missingError = Object.assign(new Error('missing'), { code: 'ENOENT' });
55describe ( 'scanForPythonVersions error handling' , ( ) => {
66 it ( 'ignores files that cannot be read' , async ( ) => {
77 vi . resetModules ( ) ;
8- vi . mock ( '../src/scanning/glob-discovery' , ( ) => ( {
8+ await vi . doMock ( '../src/scanning/glob-discovery' , ( ) => ( {
99 __esModule : true ,
1010 discoverFiles : vi . fn ( async ( ) => [ 'missing.txt' ] ) ,
1111 } ) ) ;
12- vi . mock ( 'node:fs/promises' , ( ) => ( {
12+ await vi . doMock ( 'node:fs/promises' , ( ) => ( {
1313 __esModule : true ,
1414 readFile : vi . fn ( async ( ) => {
1515 throw missingError ;
@@ -25,4 +25,32 @@ describe('scanForPythonVersions error handling', () => {
2525 vi . unmock ( '../src/scanning/glob-discovery' ) ;
2626 vi . unmock ( 'node:fs/promises' ) ;
2727 } ) ;
28+
29+ it ( 'normalizes Windows-style separators from glob discovery' , async ( ) => {
30+ vi . resetModules ( ) ;
31+ const discoverFilesMock = vi . fn ( async ( ) => [ '.github\\workflows\\ci.yml' ] ) ;
32+ await vi . doMock ( '../src/scanning/glob-discovery' , ( ) => ( {
33+ __esModule : true ,
34+ discoverFiles : discoverFilesMock ,
35+ } ) ) ;
36+ await vi . doMock ( 'node:fs/promises' , ( ) => ( {
37+ __esModule : true ,
38+ readFile : vi . fn ( async ( ) => 'python-version: "3.13.2"' ) ,
39+ } ) ) ;
40+
41+ const { scanForPythonVersions } = await import ( '../src/scanning/scanner' ) ;
42+ const result = await scanForPythonVersions ( {
43+ root : '.' ,
44+ patterns : [ '**/*.yml' ] ,
45+ } ) ;
46+
47+ expect ( discoverFilesMock ) . toHaveBeenCalled ( ) ;
48+ expect ( result . filesScanned ) . toBe ( 1 ) ;
49+ expect ( result . matches ) . toEqual ( [
50+ expect . objectContaining ( { file : '.github/workflows/ci.yml' , matched : '3.13.2' } ) ,
51+ ] ) ;
52+
53+ vi . unmock ( '../src/scanning/glob-discovery' ) ;
54+ vi . unmock ( 'node:fs/promises' ) ;
55+ } ) ;
2856} ) ;
0 commit comments