mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
7df11ed734
* refactor(lint): extract custom oxlint rules into separate files Split `tools/lint/rules.js` into one file per rule under `tools/lint/rules/`. Also simplify `test-root-describe` with early-exit guard clauses. * feat(lint): add `enforce-ts-extension` oxlint rule Add a custom JS-based oxlint rule that enforces `.ts` extensions on local imports. The rule catches two problems: - `.js` extension used instead of `.ts` (auto-fixable) - missing file extension entirely (report only) Checked locations: - static import/export declarations - dynamic `import()` expressions - vitest module APIs: `vi.mock`, `vi.doMock`, `vi.unmock`, `vi.doUnmock`, `vi.importActual`, `vi.importMock` Both relative paths (`./`, `../`) and path aliases (`~test/`) are treated as local. Package imports are ignored. Also fixes 26 pre-existing violations across 18 spec files. * Update tools/lint/rules/enforce-ts-extension.js Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com> --------- Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com>
30 lines
767 B
TypeScript
30 lines
767 B
TypeScript
import { acquireLock, getMutex } from './mutex.ts';
|
|
|
|
vi.unmock('./mutex.ts');
|
|
|
|
describe('util/mutex', () => {
|
|
describe('getMutex', () => {
|
|
it('returns mutex with default namespace', () => {
|
|
expect(getMutex('test')).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('acquireLock', () => {
|
|
afterEach(() => {
|
|
getMutex('test').release();
|
|
});
|
|
|
|
it('return lock function with default namespace', async () => {
|
|
await expect(acquireLock('test')).resolves.toBeFunction();
|
|
});
|
|
|
|
it('should lock if already used', async () => {
|
|
const mutex = getMutex('test');
|
|
const releaseLock = await acquireLock('test');
|
|
expect(mutex.isLocked()).toBeTrue();
|
|
releaseLock();
|
|
expect(mutex.isLocked()).toBeFalse();
|
|
});
|
|
});
|
|
});
|