Skip to content

Commit 03fc900

Browse files
committed
fix(workflow-code): the type check never emits, whatever tsconfig.json says
1 parent 99c2547 commit 03fc900

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎packages/sim-cli/src/commands/protocol/source-types.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ async function tscErrors(root: string): Promise<ReturnType<typeof parseTscOutput
264264
const finished = await run(
265265
'TypeScript',
266266
process.execPath,
267-
[tsc, '-p', '.', '--pretty', 'false'],
267+
// --noEmit: a tsconfig.json the person wrote may emit, and a check writes nothing.
268+
[tsc, '-p', '.', '--pretty', 'false', '--noEmit'],
268269
{
269270
cwd: root,
270271
}

‎packages/sim-cli/src/commands/protocol/workspace-source-get.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,27 @@ describe('the type check of workspaces source check', () => {
14001400
])
14011401
})
14021402

1403+
it('writes no build output under a tsconfig.json of its own that emits', async () => {
1404+
serve({ 'tables/leads.ts': LEADS })
1405+
await get()
1406+
writeInserting('leads')
1407+
const tsconfig = JSON.parse(
1408+
readFileSync(join(dir, 'tsconfig.json'), 'utf8').replace(/^\/\/.*\n/, '')
1409+
)
1410+
writeFileSync(
1411+
join(dir, 'tsconfig.json'),
1412+
JSON.stringify({
1413+
...tsconfig,
1414+
compilerOptions: { ...tsconfig.compilerOptions, noEmit: false },
1415+
})
1416+
)
1417+
1418+
await runWorkspaceSource('check', dir)
1419+
1420+
expect(result().checked).toEqual(['compile', 'types'])
1421+
expect(existsSync(join(dir, 'workflows/save/workflow.js'))).toBe(false)
1422+
})
1423+
14031424
it('skips the type check with --no-types', async () => {
14041425
serve({ 'tables/leads.ts': LEADS })
14051426
await get()

0 commit comments

Comments
 (0)