Skip to content

Commit

Permalink
fix: add esbuild check to fallback to WASM if needed (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Jun 6, 2022
1 parent 588582d commit 1ece767
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions esbuild-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// If the platform does not support the native variant of esbuild, this will crash.
// This script can then be spawned by the CLI to determine if native usage is supported.
require('esbuild')
.formatMessages([], { kind: 'error ' })
.then(
() => {},
() => {}
);
2 changes: 1 addition & 1 deletion src/ng-jest-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NgJestTransformer extends TsJestTransformer {

if (useNativeEsbuild === undefined) {
try {
const esbuildCheckPath = require.resolve('@angular-devkit/build-angular/esbuild-check.js');
const esbuildCheckPath = require.resolve('../esbuild-check.js');
const { status, error } = spawnSync(process.execPath, [esbuildCheckPath]);
useNativeEsbuild = status === 0 && error === undefined;
} catch (e) {
Expand Down

0 comments on commit 1ece767

Please sign in to comment.