feat(platform): add single-entry platform runtime
This commit is contained in:
@@ -220,6 +220,37 @@ test('compatibility graph applies the same isolation to a future platform/runtim
|
||||
assert.equal(found?.path.length, 3);
|
||||
});
|
||||
|
||||
test('platform/runtime.ts cannot import any former startup owner directly', async () => {
|
||||
const cases = [
|
||||
{ file: 'framework/platform/startup.ts', specifier: './startup.ts' },
|
||||
{ file: 'framework/net/net-client.ts', specifier: '../net/net-client.ts' },
|
||||
{ file: 'framework/platform/session.ts', specifier: './session.ts' },
|
||||
{ file: 'framework/platform/room-rpc-bus.ts', specifier: './room-rpc-bus.ts' },
|
||||
];
|
||||
|
||||
for (const item of cases) {
|
||||
const root = await createFixtureRoot();
|
||||
await writeFixture(root, item.file, 'export const legacy = true\n');
|
||||
await writeFixture(
|
||||
root,
|
||||
'framework/platform/runtime.ts',
|
||||
`import '${item.specifier}'\n`,
|
||||
);
|
||||
|
||||
const found = findCompatibilityDependency({
|
||||
entry: join(root, 'framework/platform/runtime.ts'),
|
||||
forbiddenFiles: [join(root, item.file)],
|
||||
traversalRoot: join(root, 'framework'),
|
||||
});
|
||||
assert.equal(found?.kind, 'forbidden', item.file);
|
||||
assert.deepEqual(
|
||||
found?.path.map((file) => file.replaceAll('\\', '/').split('/framework/')[1]),
|
||||
['platform/runtime.ts', item.file.slice('framework/'.length)],
|
||||
item.file,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('scanner rejects sdk contracts importing a framework platform path', async () => {
|
||||
const root = await createFixtureRoot();
|
||||
await writeFixture(root, 'framework/sdk/contracts/bad.ts', "import '../platform/session.ts'\n");
|
||||
|
||||
Reference in New Issue
Block a user