-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2978a9
commit 9649581
Showing
28 changed files
with
206 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { matchAllFiles } from './matchAllFiles.js'; | ||
|
||
import './autoload.js'; | ||
|
||
describe('matchAllFiles', () => { | ||
it('should find nothing', () => { | ||
const res = matchAllFiles([], '/'); | ||
expect(res).toStrictEqual(new Map()); | ||
}); | ||
|
||
it('should find extension based matching: typescript', () => { | ||
const res = matchAllFiles( | ||
[{ fp: '/index.tsx', name: 'index.tsx', type: 'file' }], | ||
'/' | ||
); | ||
|
||
const exp = new Map(); | ||
exp.set('typescript', ['matched extension: .tsx']); | ||
exp.set('react', ['matched extension: .tsx']); | ||
expect(res).toStrictEqual(exp); | ||
}); | ||
|
||
it('should find file based matching: nodejs', () => { | ||
const res = matchAllFiles( | ||
[{ fp: '/package.json', name: 'package.json', type: 'file' }], | ||
'/' | ||
); | ||
|
||
const exp = new Map(); | ||
exp.set('nodejs', ['matched file: package.json']); | ||
expect(res).toStrictEqual(exp); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { registeredRules } from '../register.js'; | ||
|
||
import '../autoload.js'; | ||
|
||
describe('all', () => { | ||
it('should not list multiple times the same files', () => { | ||
const files = new Set<string>(); | ||
for (const rule of registeredRules) { | ||
if (!rule.files) { | ||
continue; | ||
} | ||
if (rule.files instanceof RegExp) { | ||
const str = rule.files.toString(); | ||
if (files.has(str)) { | ||
expect(rule.files).toBe(false); | ||
continue; | ||
} | ||
|
||
files.add(str); | ||
continue; | ||
} | ||
|
||
for (const file of rule.files) { | ||
if (files.has(file)) { | ||
expect(file).toBe(false); | ||
continue; | ||
} | ||
|
||
files.add(file); | ||
} | ||
} | ||
}); | ||
|
||
// eslint-disable-next-line vitest/no-commented-out-tests | ||
// it('should not list multiple times the same extensions', () => { | ||
// const exts = new Set<string>(); | ||
// for (const rule of registeredRules) { | ||
// if (!rule.extensions) { | ||
// continue; | ||
// } | ||
|
||
// for (const ext of rule.extensions) { | ||
// if (exts.has(ext)) { | ||
// console.error(ext); | ||
// // expect(ext).toBe(false); | ||
// continue; | ||
// } | ||
|
||
// exts.add(ext); | ||
// } | ||
// } | ||
// }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ register({ | |
tech: 'bash', | ||
name: 'Bash', | ||
type: 'language', | ||
extensions: ['.sh'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ register({ | |
tech: 'c', | ||
name: 'C', | ||
type: 'language', | ||
extensions: ['.c', '.h', '.idc'], | ||
}); |
Oops, something went wrong.