Skip to content

Commit 8e06bb2

Browse files
tsc exit code [LG-3561] (#1940)
* Update build-ts.ts * Create gentle-masks-greet.md * Update build-ts.spec.ts
1 parent df544f5 commit 8e06bb2

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changeset/gentle-masks-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@lg-tools/build': patch
3+
---
4+
5+
Updates ts build script to return the same exit code as `tsc`

tools/build/src/typescript/build-ts.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import xSpawn from 'cross-spawn';
22

33
import { buildTypescript } from './build-ts';
44
type SpawnType = ReturnType<typeof xSpawn.spawn>;
5+
const onCb = (_e: string) => {};
56

67
const spawnSpy = jest.spyOn(xSpawn, 'spawn');
7-
spawnSpy.mockImplementation((...args) => ({} as SpawnType));
8+
spawnSpy.mockImplementation(
9+
(..._args) => ({ on: onCb } as unknown as SpawnType),
10+
);
811

912
describe('tools/build/build-ts', () => {
1013
test('runs with no options', () => {

tools/build/src/typescript/build-ts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ export function buildTypescript() {
1818
spawn('tsc', ['--build', tsConfigPath], {
1919
cwd: packageDir,
2020
stdio: 'inherit',
21+
}).on('exit', code => {
22+
process.exit(code ?? undefined);
2123
});
2224
}

0 commit comments

Comments
 (0)