[GEN2 backend]Jest testing issue: No context value present for amplify-backend-namespace key #2051
Open
3 tasks done
Labels
feature-request
New feature or request
p4
transferred
Issue was transferred from another Amplify repository
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
REST API
Amplify Version
v6
Amplify Categories
No response
Backend
CDK
Environment information
Describe the bug
I followed the amplify gen2 doc to add REST api to the backend, then I wrote a simple test suite to test if resources were provisioned correctly. This is the test suite:
But when I first ran the test, I got an issue
SyntaxError: Unexpected token 'export'
, and screenshot is below:So, I went to
jest.config.ts
and re-wrote the next/jest config like this:. Then I ran the test again, this time it gave me a different issue:
I am not sure what does this
No context value present for amplify-backend-namespace key
really mean, but my goal was to run some quick tests to make sure the underlying resources are provisioned correctly so that I don't have to do it by writing some scripts usingaws cli
oraws sdk
after the whole backend environment is setup and running, instead I could focus on e2e tests or something else.Expected behavior
The tests should be running successfully.
Reproduction steps
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: