Skip to content

Commit c6b42e8

Browse files
Switch to Biome (#304)
* switch to biome for static analysis
1 parent 37ffaea commit c6b42e8

87 files changed

Lines changed: 16375 additions & 17425 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
{
2-
"name": "GitHub Actions (TypeScript)",
3-
"image": "mcr.microsoft.com/devcontainers/typescript-node:24",
4-
"postCreateCommand": "npm install",
5-
"customizations": {
6-
"codespaces": {
7-
"openFiles": ["README.md"]
8-
},
9-
"vscode": {
10-
"extensions": [
11-
"bierner.markdown-preview-github-styles",
12-
"davidanson.vscode-markdownlint",
13-
"dbaeumer.vscode-eslint",
14-
"esbenp.prettier-vscode",
15-
"github.copilot",
16-
"github.copilot-chat",
17-
"github.vscode-github-actions",
18-
"github.vscode-pull-request-github",
19-
"me-dutour-mathieu.vscode-github-actions",
20-
"redhat.vscode-yaml",
21-
"rvest.vs-code-prettier-eslint",
22-
"yzhang.markdown-all-in-one"
23-
],
24-
"settings": {
25-
"editor.defaultFormatter": "esbenp.prettier-vscode",
26-
"editor.tabSize": 2,
27-
"editor.formatOnSave": true,
28-
"markdown.extension.list.indentationSize": "adaptive",
29-
"markdown.extension.italic.indicator": "_",
30-
"markdown.extension.orderedList.marker": "one"
31-
}
32-
}
33-
},
34-
"remoteEnv": {
35-
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
36-
},
37-
"features": {
38-
"ghcr.io/devcontainers/features/github-cli:1": {},
39-
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
40-
}
2+
"name": "GitHub Actions (TypeScript)",
3+
"image": "mcr.microsoft.com/devcontainers/typescript-node:24",
4+
"postCreateCommand": "npm install",
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": ["README.md"]
8+
},
9+
"vscode": {
10+
"extensions": [
11+
"bierner.markdown-preview-github-styles",
12+
"davidanson.vscode-markdownlint",
13+
"dbaeumer.vscode-eslint",
14+
"esbenp.prettier-vscode",
15+
"github.copilot",
16+
"github.copilot-chat",
17+
"github.vscode-github-actions",
18+
"github.vscode-pull-request-github",
19+
"me-dutour-mathieu.vscode-github-actions",
20+
"redhat.vscode-yaml",
21+
"rvest.vs-code-prettier-eslint",
22+
"yzhang.markdown-all-in-one"
23+
],
24+
"settings": {
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"editor.tabSize": 2,
27+
"editor.formatOnSave": true,
28+
"markdown.extension.list.indentationSize": "adaptive",
29+
"markdown.extension.italic.indicator": "_",
30+
"markdown.extension.orderedList.marker": "one"
31+
}
32+
}
33+
},
34+
"remoteEnv": {
35+
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
36+
},
37+
"features": {
38+
"ghcr.io/devcontainers/features/github-cli:1": {},
39+
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
40+
}
4141
}

.github/linters/tsconfig.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"$schema": "https://json.schemastore.org/tsconfig",
3-
"extends": "../../tsconfig.json",
4-
"compilerOptions": {
5-
"noEmit": true
6-
},
7-
"include": ["../../__tests__/**/*", "../../src/**/*"],
8-
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../__tests__/**/*", "../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
99
}

.prettierrc.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"printWidth": 80,
3-
"tabWidth": 2,
4-
"useTabs": false,
5-
"semi": false,
6-
"singleQuote": true,
7-
"quoteProps": "as-needed",
8-
"jsxSingleQuote": false,
9-
"trailingComma": "none",
10-
"bracketSpacing": true,
11-
"bracketSameLine": true,
12-
"arrowParens": "avoid",
13-
"proseWrap": "always",
14-
"htmlWhitespaceSensitivity": "css",
15-
"endOfLine": "lf"
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": true,
11+
"bracketSameLine": true,
12+
"arrowParens": "avoid",
13+
"proseWrap": "always",
14+
"htmlWhitespaceSensitivity": "css",
15+
"endOfLine": "lf"
1616
}

__tests__/ctrf/helpers.test.ts

Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,114 @@
1-
import { getEmoji, normalizeSuite, stripAnsi } from '../../src/ctrf/helpers.js'
2-
3-
describe('getEmoji', () => {
4-
it('returns the correct emoji for "passed"', () => {
5-
expect(getEmoji('passed')).toBe('✅')
6-
})
7-
8-
it('returns the correct emoji for "failed"', () => {
9-
expect(getEmoji('failed')).toBe('❌')
10-
})
11-
12-
it('returns the correct emoji for "skipped"', () => {
13-
expect(getEmoji('skipped')).toBe('⏭️')
14-
})
15-
16-
it('returns the correct emoji for "pending"', () => {
17-
expect(getEmoji('pending')).toBe('⏳')
18-
})
19-
20-
it('returns the correct emoji for "other"', () => {
21-
expect(getEmoji('other')).toBe('❓')
22-
})
23-
24-
it('returns the correct emoji for "build"', () => {
25-
expect(getEmoji('build')).toBe('🏗️')
26-
})
27-
28-
it('returns the correct emoji for "duration"', () => {
29-
expect(getEmoji('duration')).toBe('⏱️')
30-
})
31-
32-
it('returns the correct emoji for "flaky"', () => {
33-
expect(getEmoji('flaky')).toBe('🍂')
34-
})
35-
36-
it('returns the correct emoji for "tests"', () => {
37-
expect(getEmoji('tests')).toBe('📝')
38-
})
39-
40-
it('returns the correct emoji for "result"', () => {
41-
expect(getEmoji('result')).toBe('🧪')
42-
})
43-
})
44-
45-
describe('normalizeSuite', () => {
46-
it('handles array format (new CTRF format) with default separator', () => {
47-
const suiteArray = ['string.test.ts', 'String Helpers', 'splitLines']
48-
const result = normalizeSuite(suiteArray)
49-
expect(result).toBe('string.test.ts > String Helpers > splitLines')
50-
})
51-
52-
it('handles array format with custom separator', () => {
53-
const suiteArray = ['suite1', 'suite2', 'suite3']
54-
const result = normalizeSuite(suiteArray, ' / ')
55-
expect(result).toBe('suite1 / suite2 / suite3')
56-
})
57-
58-
it('handles string format (legacy CTRF format)', () => {
59-
const suiteString = 'string.test.ts > String Helpers > splitLines'
60-
const result = normalizeSuite(suiteString)
61-
expect(result).toBe('string.test.ts > String Helpers > splitLines')
62-
})
63-
64-
it('returns undefined when suite is undefined', () => {
65-
const result = normalizeSuite(undefined)
66-
expect(result).toBeUndefined()
67-
})
68-
69-
it('handles empty array', () => {
70-
const result = normalizeSuite([])
71-
expect(result).toBe('')
72-
})
73-
74-
it('handles single element array', () => {
75-
const result = normalizeSuite(['suite1'])
76-
expect(result).toBe('suite1')
77-
})
78-
79-
it('handles empty string', () => {
80-
const result = normalizeSuite('')
81-
expect(result).toBeUndefined()
82-
})
83-
})
84-
85-
describe('stripAnsi', () => {
86-
it('removes ANSI escape codes from a string', () => {
87-
const ansiString = '\u001b[31mHello\u001b[39m'
88-
const result = stripAnsi(ansiString)
89-
expect(result).toBe('Hello')
90-
})
91-
92-
it('returns the same string if no ANSI codes are present', () => {
93-
const normalString = 'Just a normal string'
94-
const result = stripAnsi(normalString)
95-
expect(result).toBe(normalString)
96-
})
97-
98-
it('handles empty strings correctly', () => {
99-
const emptyString = ''
100-
const result = stripAnsi(emptyString)
101-
expect(result).toBe('')
102-
})
103-
104-
it('throws a TypeError if the input is not a string', () => {
105-
// @ts-expect-error Testing runtime error
106-
expect(() => stripAnsi(123)).toThrow(TypeError)
107-
// @ts-expect-error Testing runtime error
108-
expect(() => stripAnsi(null)).toThrow(TypeError)
109-
// @ts-expect-error Testing runtime error
110-
expect(() => stripAnsi(undefined)).toThrow(TypeError)
111-
// @ts-expect-error Testing runtime error
112-
expect(() => stripAnsi({})).toThrow(TypeError)
113-
})
114-
})
1+
import { getEmoji, normalizeSuite, stripAnsi } from "../../src/ctrf/helpers.js";
2+
3+
describe("getEmoji", () => {
4+
it('returns the correct emoji for "passed"', () => {
5+
expect(getEmoji("passed")).toBe("✅");
6+
});
7+
8+
it('returns the correct emoji for "failed"', () => {
9+
expect(getEmoji("failed")).toBe("❌");
10+
});
11+
12+
it('returns the correct emoji for "skipped"', () => {
13+
expect(getEmoji("skipped")).toBe("⏭️");
14+
});
15+
16+
it('returns the correct emoji for "pending"', () => {
17+
expect(getEmoji("pending")).toBe("⏳");
18+
});
19+
20+
it('returns the correct emoji for "other"', () => {
21+
expect(getEmoji("other")).toBe("❓");
22+
});
23+
24+
it('returns the correct emoji for "build"', () => {
25+
expect(getEmoji("build")).toBe("🏗️");
26+
});
27+
28+
it('returns the correct emoji for "duration"', () => {
29+
expect(getEmoji("duration")).toBe("⏱️");
30+
});
31+
32+
it('returns the correct emoji for "flaky"', () => {
33+
expect(getEmoji("flaky")).toBe("🍂");
34+
});
35+
36+
it('returns the correct emoji for "tests"', () => {
37+
expect(getEmoji("tests")).toBe("📝");
38+
});
39+
40+
it('returns the correct emoji for "result"', () => {
41+
expect(getEmoji("result")).toBe("🧪");
42+
});
43+
});
44+
45+
describe("normalizeSuite", () => {
46+
it("handles array format (new CTRF format) with default separator", () => {
47+
const suiteArray = ["string.test.ts", "String Helpers", "splitLines"];
48+
const result = normalizeSuite(suiteArray);
49+
expect(result).toBe("string.test.ts > String Helpers > splitLines");
50+
});
51+
52+
it("handles array format with custom separator", () => {
53+
const suiteArray = ["suite1", "suite2", "suite3"];
54+
const result = normalizeSuite(suiteArray, " / ");
55+
expect(result).toBe("suite1 / suite2 / suite3");
56+
});
57+
58+
it("handles string format (legacy CTRF format)", () => {
59+
const suiteString = "string.test.ts > String Helpers > splitLines";
60+
const result = normalizeSuite(suiteString);
61+
expect(result).toBe("string.test.ts > String Helpers > splitLines");
62+
});
63+
64+
it("returns undefined when suite is undefined", () => {
65+
const result = normalizeSuite(undefined);
66+
expect(result).toBeUndefined();
67+
});
68+
69+
it("handles empty array", () => {
70+
const result = normalizeSuite([]);
71+
expect(result).toBe("");
72+
});
73+
74+
it("handles single element array", () => {
75+
const result = normalizeSuite(["suite1"]);
76+
expect(result).toBe("suite1");
77+
});
78+
79+
it("handles empty string", () => {
80+
const result = normalizeSuite("");
81+
expect(result).toBeUndefined();
82+
});
83+
});
84+
85+
describe("stripAnsi", () => {
86+
it("removes ANSI escape codes from a string", () => {
87+
const ansiString = "\u001b[31mHello\u001b[39m";
88+
const result = stripAnsi(ansiString);
89+
expect(result).toBe("Hello");
90+
});
91+
92+
it("returns the same string if no ANSI codes are present", () => {
93+
const normalString = "Just a normal string";
94+
const result = stripAnsi(normalString);
95+
expect(result).toBe(normalString);
96+
});
97+
98+
it("handles empty strings correctly", () => {
99+
const emptyString = "";
100+
const result = stripAnsi(emptyString);
101+
expect(result).toBe("");
102+
});
103+
104+
it("throws a TypeError if the input is not a string", () => {
105+
// @ts-expect-error Testing runtime error
106+
expect(() => stripAnsi(123)).toThrow(TypeError);
107+
// @ts-expect-error Testing runtime error
108+
expect(() => stripAnsi(null)).toThrow(TypeError);
109+
// @ts-expect-error Testing runtime error
110+
expect(() => stripAnsi(undefined)).toThrow(TypeError);
111+
// @ts-expect-error Testing runtime error
112+
expect(() => stripAnsi({})).toThrow(TypeError);
113+
});
114+
});

0 commit comments

Comments
 (0)