Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/app/lib/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import type { FeatureManifest } from '@shared/shell/features';

const modules = import.meta.glob<{ default: FeatureManifest }>('../features/*/index.ts', {
const modules = import.meta.glob<{ default: FeatureManifest }>('../../features/*/index.ts', {
eager: true,
});

Expand Down
23 changes: 23 additions & 0 deletions frontend/src/app/test/registry.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* The registry must find every folder in src/features/. A glob that matches nothing is no error to
* Vite, so a wrong path would otherwise start the app with no pages and no navigation.
*/
import { describe, expect, it } from 'vitest';

import { discoverFeatures } from '../lib/registry';

// Every file of every feature, unloaded: only the paths are read.
const featureFiles = Object.keys(import.meta.glob('../../features/*/**'));

describe('discoverFeatures', () => {
it('finds a manifest for every feature folder', () => {
const folders = [
...new Set(featureFiles.map(file => /features\/([^/]+)\//.exec(file)?.[1] ?? '')),
].sort((a, b) => a.localeCompare(b));
const ids = discoverFeatures()
.map(feature => feature.id)
.sort((a, b) => a.localeCompare(b));
expect(folders.length).toBeGreaterThan(0);
expect(ids).toEqual(folders);
});
});
Loading