Skip to content

Commit

Permalink
tsc exit code [LG-3561] (#1940)
Browse files Browse the repository at this point in the history
* Update build-ts.ts

* Create gentle-masks-greet.md

* Update build-ts.spec.ts
  • Loading branch information
TheSonOfThomp authored Aug 22, 2023
1 parent df544f5 commit 8e06bb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gentle-masks-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-tools/build': patch
---

Updates ts build script to return the same exit code as `tsc`
5 changes: 4 additions & 1 deletion tools/build/src/typescript/build-ts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import xSpawn from 'cross-spawn';

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

const spawnSpy = jest.spyOn(xSpawn, 'spawn');
spawnSpy.mockImplementation((...args) => ({} as SpawnType));
spawnSpy.mockImplementation(
(..._args) => ({ on: onCb } as unknown as SpawnType),
);

describe('tools/build/build-ts', () => {
test('runs with no options', () => {
Expand Down
2 changes: 2 additions & 0 deletions tools/build/src/typescript/build-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export function buildTypescript() {
spawn('tsc', ['--build', tsConfigPath], {
cwd: packageDir,
stdio: 'inherit',
}).on('exit', code => {
process.exit(code ?? undefined);
});
}

0 comments on commit 8e06bb2

Please sign in to comment.