forked from Lilly-Protocol/lily-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci-matrix-node24.test.ts
More file actions
44 lines (39 loc) · 1.24 KB
/
Copy pathci-matrix-node24.test.ts
File metadata and controls
44 lines (39 loc) · 1.24 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { describe, it, expect } from 'vitest';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
/**
* Bounty #86 — $30
* "Expand the CI matrix to Node 24"
*
* Verifies that the CI matrix includes Node 24.
*/
describe('CI matrix includes Node 24', () => {
const ciPath = resolve(process.cwd(), '.github/workflows');
const files = ['ci.yml', 'main.yml', 'test.yml', 'publish.yml'];
function getCiContent(): string | null {
for (const file of files) {
const fullPath = resolve(ciPath, file);
try {
const content = readFileSync(fullPath, 'utf8');
return content;
} catch {
// try next file
}
}
return null;
}
it('has a CI workflow file', () => {
const content = getCiContent();
expect(content).not.toBeNull();
});
it('CI matrix includes Node 24', () => {
const content = getCiContent();
expect(content).toContain('24');
});
it('CI matrix includes at least 2 Node versions', () => {
const content = getCiContent();
const nodeVersions = content?.match(/['"]?(\d+)['"]?/g) ?? [];
const uniqueVersions = new Set(nodeVersions.map((v) => v.replace(/['"]/g, '')));
expect(uniqueVersions.size).toBeGreaterThanOrEqual(2);
});
});