Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda-nodejs): local tsc detection with pre compilation #19266

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class Bundling implements cdk.BundlingOptions {
this.packageManager = PackageManager.fromLockFile(props.depsLockFilePath, props.logLevel);

Bundling.esbuildInstallation = Bundling.esbuildInstallation ?? PackageInstallation.detect('esbuild');
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('tsc');
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('typescript');

this.projectRoot = props.projectRoot;
this.relativeEntryPath = path.relative(this.projectRoot, path.resolve(props.entry));
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ beforeEach(() => {
jest.resetAllMocks();
jest.restoreAllMocks();
Bundling.clearEsbuildInstallationCache();
Bundling.clearTscInstallationCache();

jest.spyOn(Code, 'fromAsset');

Expand Down Expand Up @@ -602,6 +603,8 @@ test('esbuild bundling with pre compilations', () => {
],
}),
});

expect(detectPackageInstallationMock).toHaveBeenCalledWith('typescript');
});

test('throws with pre compilation and not found tsconfig', () => {
Expand Down