mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
27 lines
908 B
TypeScript
27 lines
908 B
TypeScript
import assert from 'node:assert/strict';
|
|
import { test } from 'node:test';
|
|
import { sourceExecutionCompatibilityViolations } from './source-execution-policy.ts';
|
|
|
|
test('source-executed syntax rejects using declarations but ignores prose', () => {
|
|
const violations = sourceExecutionCompatibilityViolations(
|
|
new Map([
|
|
[
|
|
'packages/platform-apple/src/logs/planted.ts',
|
|
`
|
|
// await using oldHandle = acquire();
|
|
const migrationNote = 'using replacement = acquire()';
|
|
async function run() { await using handle = acquire(); }
|
|
function runSync() { using cleanup = acquireSync(); }
|
|
`,
|
|
],
|
|
]),
|
|
);
|
|
assert.deepEqual(
|
|
violations.map(({ message }) => message),
|
|
[
|
|
'source-executed TypeScript uses unsupported await using declaration',
|
|
'source-executed TypeScript uses unsupported using declaration',
|
|
],
|
|
);
|
|
});
|