Skip to content

Commit 7062c65

Browse files
committed
fix(workflow-code): the type check never emits, whatever tsconfig.json says
1 parent 44e1d80 commit 7062c65

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
@@ -1402,6 +1402,27 @@ describe('the type check of workspaces source check', () => {
14021402
])
14031403
})
14041404

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

0 commit comments

Comments
 (0)