mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
ci(client): lint:size measures the Playwright specs and fixtures too
The size check walked src/ and tests/ only, while lint:format and lint:skips already cover e2e/. The help center fixtures under e2e/help/fixtures.ts hold 2291 wrapped lines, past the 2000 a test may reach, and could grow without bound. e2e/ is now measured with the test limit; fixtures.ts enters the baseline at its current size, every other file there is within the limit.
This commit is contained in:
@@ -24,13 +24,15 @@ export const WIDTH = 120;
|
||||
/**
|
||||
* The kinds of file the check covers, each with the size a file without a
|
||||
* baseline entry may reach. Tests get more room: a spec mirrors the component
|
||||
* it covers and holds fixtures, but past LIMIT it is a god file too.
|
||||
* it covers and holds fixtures, but past LIMIT it is a god file too. The
|
||||
* Playwright specs and their fixtures under e2e/ count as tests.
|
||||
*/
|
||||
export const GROUPS = [
|
||||
{
|
||||
name: 'test',
|
||||
limit: 2000,
|
||||
accepts: (key) => /\.tsx?$/.test(key) && (key.startsWith('tests/') || TEST_FILE.test(key)),
|
||||
accepts: (key) =>
|
||||
/\.tsx?$/.test(key) && (key.startsWith('tests/') || key.startsWith('e2e/') || TEST_FILE.test(key)),
|
||||
},
|
||||
{
|
||||
name: 'source',
|
||||
@@ -40,7 +42,7 @@ export const GROUPS = [
|
||||
{ name: 'stylesheet', limit: 1000, accepts: (key) => key.startsWith('src/') && key.endsWith('.css') },
|
||||
];
|
||||
|
||||
export const DIRS = ['src', 'tests'];
|
||||
export const DIRS = ['src', 'tests', 'e2e'];
|
||||
|
||||
export function groupOf(key) {
|
||||
return GROUPS.find((group) => group.accepts(key)) ?? null;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"e2e/help/fixtures.ts": 2291,
|
||||
"src/api/client.ts": 1916,
|
||||
"src/components/Admin/AdminPluginsPanel.test.tsx": 2704,
|
||||
"src/components/Admin/AdminPluginsPanel.tsx": 2431,
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*
|
||||
* A file past a thousand lines holds several concerns that no longer fit in
|
||||
* one reading, and every change to one of them risks the others. Each source
|
||||
* file and stylesheet under src/ may hold 1000 lines, each test (under tests/
|
||||
* or a co-located *.test.*) 2000. Lines are counted as an editor wraps them
|
||||
* file and stylesheet under src/ may hold 1000 lines, each test (under tests/,
|
||||
* a Playwright spec or fixture under e2e/, or a co-located *.test.*) 2000. Lines are counted as an editor wraps them
|
||||
* at 120 columns, so joining lines does not make a file smaller. The files
|
||||
* that were already larger are listed in scripts/size-baseline.json with the
|
||||
* size they had, and the check fails when one of them grows past its entry. A
|
||||
|
||||
Reference in New Issue
Block a user