diff --git a/packages/esbuild-plugin-typecheck/test/fixture/build/pkg-three/build.js b/packages/esbuild-plugin-typecheck/test/fixture/build/pkg-three/build.js index 345b835..b4e2662 100755 --- a/packages/esbuild-plugin-typecheck/test/fixture/build/pkg-three/build.js +++ b/packages/esbuild-plugin-typecheck/test/fixture/build/pkg-three/build.js @@ -2,20 +2,30 @@ const { typecheckPlugin } = require('../../../lib'); const { build } = require('esbuild'); -const path = require('path'); -build({ - absWorkingDir: __dirname, - entryPoints: ['./three.ts'], - bundle: true, - format: 'esm', - outdir: './dist', - platform: 'node', - plugins: [ - typecheckPlugin({ - buildMode: process.env.BUILD_MODE, - }), - ], - watch: !!process.env.WATCH, - write: false, -}).catch(() => process.exit(1)); +async function main() { + try { + const result = await build({ + absWorkingDir: __dirname, + entryPoints: ['./three.ts'], + bundle: true, + format: 'esm', + outdir: './dist', + platform: 'node', + plugins: [ + typecheckPlugin({ + buildMode: process.env.BUILD_MODE, + }), + ], + watch: !!process.env.WATCH, + write: false, + }); + process.on('SIGTERM', () => { + result.stop(); + }); + } catch (error) { + process.exit(1); + } +} + +main(); diff --git a/packages/esbuild-plugin-typecheck/test/fixture/compile/build.js b/packages/esbuild-plugin-typecheck/test/fixture/compile/build.js index 90b4ede..befd30e 100755 --- a/packages/esbuild-plugin-typecheck/test/fixture/compile/build.js +++ b/packages/esbuild-plugin-typecheck/test/fixture/compile/build.js @@ -2,16 +2,26 @@ const { typecheckPlugin } = require('../../lib'); const { build } = require('esbuild'); -const path = require('path'); -build({ - absWorkingDir: __dirname, - entryPoints: ['./src/index.ts'], - bundle: true, - format: 'esm', - outdir: './dist', - platform: 'node', - plugins: [typecheckPlugin()], - watch: !!process.env.WATCH, - write: false, -}).catch(() => process.exit(1)); +async function main() { + try { + const result = await build({ + absWorkingDir: __dirname, + entryPoints: ['./src/index.ts'], + bundle: true, + format: 'esm', + outdir: './dist', + platform: 'node', + plugins: [typecheckPlugin()], + watch: !!process.env.WATCH, + write: false, + }); + process.on('SIGTERM', () => { + result.stop(); + }); + } catch (error) { + process.exit(1); + } +} + +main();