mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
test(performance): skip every test-only file suffix in the zoneless guard (#1831)
* test(performance): skip every test-only file suffix in the zoneless guard #1813 added serial-details.test-stubs.ts, whose stub components set ChangeDetectionStrategy.Eager. The zoneless checklist guard listed only some test-only suffixes, counted the stub file as production code and has failed the performance-harness job on master since. It now skips every `.spec` / `.test` file with or without a suffix, test-setup.ts and test-stubs/ directories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(performance): accept multi-segment test-only suffixes in the zoneless guard Review follow-up (Greptile): `(-\w+)?` allowed one suffix segment, so a file such as `rail.test-data-stubs.ts` would be scanned as production. The suffix now repeats, and a classifier test pins which names are skipped and which ship. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: 4gray <fourgray@proton.me> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+36
-5
No files matched your search
@@ -12,9 +12,16 @@ import { fileURLToPath } from 'node:url';
|
|||||||
const workspaceRoot = fileURLToPath(new URL('../../../../', import.meta.url));
|
const workspaceRoot = fileURLToPath(new URL('../../../../', import.meta.url));
|
||||||
const checklistPath = 'docs/architecture/zoneless-migration.md';
|
const checklistPath = 'docs/architecture/zoneless-migration.md';
|
||||||
const sourceRoots = ['apps', 'libs'];
|
const sourceRoots = ['apps', 'libs'];
|
||||||
const skippedDirectories = new Set(['node_modules', 'dist', 'coverage']);
|
const skippedDirectories = new Set([
|
||||||
const testOnlyFile =
|
'node_modules',
|
||||||
/(\.spec|\.spec-stubs|\.spec-data|\.test-helpers|test-setup)\.ts$/;
|
'dist',
|
||||||
|
'coverage',
|
||||||
|
'test-stubs',
|
||||||
|
]);
|
||||||
|
// Test-only files follow the repository's `.spec` / `.test` naming, with an
|
||||||
|
// optional suffix of one or more segments (`.spec-stubs.ts`,
|
||||||
|
// `.test-helpers.ts`, `.test-data-stubs.ts`).
|
||||||
|
const testOnlyFile = /(\.(spec|test)(-\w+)*|^test-setup)\.ts$/;
|
||||||
|
|
||||||
function listProductionSources(directory: string): string[] {
|
function listProductionSources(directory: string): string[] {
|
||||||
const files: string[] = [];
|
const files: string[] = [];
|
||||||
@@ -78,6 +85,27 @@ test('the zoneless checklist lists exactly the components that are still Eager',
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('the guard skips test-only file names and keeps production ones', () => {
|
||||||
|
for (const name of [
|
||||||
|
'player.component.spec.ts',
|
||||||
|
'serial-details.test-stubs.ts',
|
||||||
|
'dashboard.spec-stubs.ts',
|
||||||
|
'rail.test-data-stubs.ts',
|
||||||
|
'test-setup.ts',
|
||||||
|
]) {
|
||||||
|
assert.ok(testOnlyFile.test(name), `${name} is test-only`);
|
||||||
|
}
|
||||||
|
for (const name of [
|
||||||
|
'player.component.ts',
|
||||||
|
'spec-utils.ts',
|
||||||
|
'contest.ts',
|
||||||
|
'latest-setup.ts',
|
||||||
|
'testing.service.ts',
|
||||||
|
]) {
|
||||||
|
assert.ok(!testOnlyFile.test(name), `${name} ships`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('ticked checklist entries name files that exist', () => {
|
test('ticked checklist entries name files that exist', () => {
|
||||||
for (const file of readEagerChecklist().done) {
|
for (const file of readEagerChecklist().done) {
|
||||||
assert.ok(sources.has(file), `${file} is ticked but does not exist`);
|
assert.ok(sources.has(file), `${file} is ticked but does not exist`);
|
||||||
|
|||||||
@@ -153,8 +153,11 @@ files that still contain `ChangeDetectionStrategy.Eager`.
|
|||||||
- [ ] `libs/portal/xtream/feature/src/lib/global-search-results/global-search-results.component.ts`
|
- [ ] `libs/portal/xtream/feature/src/lib/global-search-results/global-search-results.component.ts`
|
||||||
- [ ] `libs/portal/xtream/feature/src/lib/serial-details/serial-details.component.ts`
|
- [ ] `libs/portal/xtream/feature/src/lib/serial-details/serial-details.component.ts`
|
||||||
|
|
||||||
Test stubs that set Eager (`*.spec.ts`, `*.spec-stubs.ts`, `*.spec-data.ts`,
|
Test-only files that set Eager are not listed; they do not ship. The guard
|
||||||
`*.test-helpers.ts`) are not listed; they do not ship.
|
skips every `*.spec.ts` / `*.test.ts` file with or without a suffix of one
|
||||||
|
or more segments (`*.spec-stubs.ts`, `*.test-helpers.ts`,
|
||||||
|
`*.test-data-stubs.ts`, …),
|
||||||
|
`test-setup.ts` and `test-stubs/` directories.
|
||||||
|
|
||||||
## Zone-dependent sites
|
## Zone-dependent sites
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user