Skip to content

Commit 8e9b510

Browse files
authored
Merge pull request #560 from elsassph/feat/ci
Add Github workflow to validate PRs
2 parents c188d6b + b735932 commit 8e9b510

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

.github/workflows/pr-validation.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PR Validation
2+
3+
on:
4+
pull_request:
5+
branches: [ master, dev ]
6+
push:
7+
branches: [ master, dev ]
8+
9+
jobs:
10+
test-and-build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [20.x, 22.x]
16+
include:
17+
- node-version: 20.x
18+
experimental: false
19+
- node-version: 22.x
20+
experimental: true
21+
22+
continue-on-error: ${{ matrix.experimental }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: 'npm'
32+
33+
- name: Install dependencies
34+
run: npm ci
35+
36+
- name: Type Check
37+
run: npx tsc --noEmit
38+
39+
- name: Run tests
40+
run: npm test
41+
42+
- name: Build
43+
run: npm run build
44+
45+
- name: Type Validation
46+
run: npm run tsd

src/textures/TextTextureRendererUtils.test.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ import { getFontSetting, tokenizeString, isSpace, isZeroWidthSpace, wrapText, me
44
describe('TextTextureRendererUtils', () => {
55
describe('getFontSetting', () => {
66
it('should form a valid CSS font string', () => {
7-
expect(getFontSetting('Arial', 'normal', 12, 1, 'Default')).toBe('normal 12px "Arial"');
7+
expect(getFontSetting('Arial', 'normal', 12, 1, 'Default')).toBe('normal 12px Arial');
88
expect(getFontSetting('Times New Roman', 'bold', 30, 1, 'Default')).toBe('bold 30px "Times New Roman"');
99
});
1010
it('should adjust font size for precision', () => {
11-
expect(getFontSetting('Arial', 'normal', 12, 2, 'Default')).toBe('normal 24px "Arial"');
11+
expect(getFontSetting('Arial', 'normal', 12, 2, 'Default')).toBe('normal 24px Arial');
1212
});
1313
it('should support "serif" and "sans-serif" specially', () => {
1414
expect(getFontSetting('serif', 'italic', 12, 1, 'Default')).toBe('italic 12px serif');
1515
expect(getFontSetting('sans-serif', 'normal', 12, 1, 'Default')).toBe('normal 12px sans-serif');
1616
});
1717
it('should default to the defaultFontFace if fontFace is null', () => {
18-
expect(getFontSetting(null, 'normal', 12, 1, 'Default')).toBe('normal 12px "Default"');
19-
expect(getFontSetting([null], 'normal', 12, 1, 'Default')).toBe('normal 12px "Default"');
18+
expect(getFontSetting(null, 'normal', 12, 1, 'Default')).toBe('normal 12px Default');
19+
expect(getFontSetting([null], 'normal', 12, 1, 'Default')).toBe('normal 12px Default');
2020
});
2121
it('should defaultFontFace should also handle "serif" and "sans-serif" specially', () => {
2222
expect(getFontSetting(null, 'normal', 12, 1, 'serif')).toBe('normal 12px serif');
2323
expect(getFontSetting([null], 'normal', 12, 1, 'sans-serif')).toBe('normal 12px sans-serif');
2424
});
2525
it('should support an array of fonts', () => {
26-
expect(getFontSetting(['Arial'], 'normal', 12, 1, 'Default')).toBe('normal 12px "Arial"');
27-
expect(getFontSetting(['serif', 'Arial'], 'italic', 12, 1, 'Default')).toBe('italic 12px serif,"Arial"');
28-
expect(getFontSetting(['serif', 'Arial', null], 'bold', 12, 1, 'Default')).toBe('bold 12px serif,"Arial","Default"');
26+
expect(getFontSetting(['Arial'], 'normal', 12, 1, 'Default')).toBe('normal 12px Arial');
27+
expect(getFontSetting(['serif', 'Arial'], 'italic', 12, 1, 'Default')).toBe('italic 12px serif,Arial');
28+
expect(getFontSetting(['serif', 'Arial', null], 'bold', 12, 1, 'Default')).toBe('bold 12px serif,Arial,Default');
2929
});
3030
});
3131

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"sourceMap": true,
2121
"declarationMap": true,
2222
"isolatedModules": true,
23+
"skipLibCheck": true,
2324

2425
// Don't emit any files via the root tsconfig.json
2526
// (this is a project-wide config and includes the test-d folder which

0 commit comments

Comments
 (0)