forked from refined-github/refined-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature-renames.test.ts
More file actions
28 lines (23 loc) · 905 Bytes
/
feature-renames.test.ts
File metadata and controls
28 lines (23 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {execSync} from 'node:child_process';
import fs from 'node:fs/promises';
import path from 'node:path';
import {test, expect} from 'vitest';
import featureRenames from './feature-renames.json';
const oldNames = Object.keys(featureRenames);
const newNames = Object.values(featureRenames);
test('old feature names cannot appear anywhere in the repo', () => {
for (const oldName of oldNames) {
const grep = `rg -l "[^-]${oldName}[^-]" -g !feature-renames.json -g !package-lock.json`;
let results;
try {
results = execSync(grep, {encoding: 'utf8'});
} catch {
continue;
}
throw new Error(`Old feature name "${oldName}" found in ${results}`);
}
});
test.concurrent.each(newNames)('new feature must exist: source/features/%s.tsx', async newName => {
const filePath = path.join('source', 'features', `${newName}.tsx`);
await expect(fs.stat(filePath)).resolves.toBeDefined();
});