-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test(aws): Run E2E tests with AWS SAM #17367
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
Conversation
dev-packages/e2e-tests/test-applications/aws-lambda-sam/tests/lambda.test.ts
Fixed
Show fixed
Hide fixed
571fd01
to
17e2e48
Compare
size-limit report 📦
|
17e2e48
to
a18aba3
Compare
a18aba3
to
59a480a
Compare
459c629
to
3393bce
Compare
import { test as base, expect } from '@playwright/test'; | ||
import { App } from 'aws-cdk-lib'; | ||
import * as tmp from 'tmp'; | ||
import { LocalLambdaStack, SAM_PORT, getHostIp } from '../src/stack.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test Runner Fails on Module Resolution
E2E tests fail due to module resolution errors. lambda-fixtures.ts
imports ../src/stack.js
and npm.test.ts
imports ./lambda-fixtures.js
, but the corresponding files only exist as .ts
(e.g., src/stack.ts
, lambda-fixtures.ts
). The Playwright/TS test runner cannot resolve these .js
imports to .ts
files without a build step, resulting in "Cannot find module" errors and preventing the SAM test environment from starting.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems right, shouldn't have a file ending right?
@@ -0,0 +1,169 @@ | |||
import { waitForTransaction, waitForError } from '@sentry-internal/test-utils'; | |||
import { InvokeCommand } from '@aws-sdk/client-lambda'; | |||
import { test, expect } from './lambda-fixtures.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect File Extension in TypeScript Import
The layer.test.ts
file incorrectly imports ./lambda-fixtures.js
. Since the actual file is lambda-fixtures.ts
, Playwright's TypeScript runtime fails to resolve the .js
extension, causing a module-not-found error. This breaks the new SAM E2E tests in CI. The import should be ./lambda-fixtures
or ./lambda-fixtures.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement, let's also write a vanguard about it!
import { test as base, expect } from '@playwright/test'; | ||
import { App } from 'aws-cdk-lib'; | ||
import * as tmp from 'tmp'; | ||
import { LocalLambdaStack, SAM_PORT, getHostIp } from '../src/stack.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems right, shouldn't have a file ending right?
@@ -0,0 +1,169 @@ | |||
import { waitForTransaction, waitForError } from '@sentry-internal/test-utils'; | |||
import { InvokeCommand } from '@aws-sdk/client-lambda'; | |||
import { test, expect } from './lambda-fixtures.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this too.
@@ -0,0 +1,141 @@ | |||
import { waitForTransaction } from '@sentry-internal/test-utils'; | |||
import { InvokeCommand } from '@aws-sdk/client-lambda'; | |||
import { test, expect } from './lambda-fixtures.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { test, expect } from './lambda-fixtures.js'; | |
import { test, expect } from './lambda-fixtures'; |
Introduces new E2E tests for AWS Lambda that run in a Lambda runtime using AWS SAM and the AWS CDK, inspired by https://vanguard.getsentry.net/p/cm7ysk0mz0000c7sk3e2qx3sx