-
Notifications
You must be signed in to change notification settings - Fork 318
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
test(build system): add React tests for loadtest #3703
Conversation
@@ -0,0 +1,35 @@ | |||
{ |
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.
Was this file autogenerated?
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.
It was modified from the auto-generated nextjs 13
} from '@aws-amplify/ui-react'; | ||
import { StorageManager } from '@aws-amplify/ui-react-storage'; | ||
import '@aws-amplify/ui-react/styles.css'; | ||
import awsconfig from '@/data/aws-exports'; |
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.
Can we use relative path instead of @/
?
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.
@/
was from the auto-generated config. Since we try to mimic the users behavior, it might be better not change it
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.
Understood, not blocking then.
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.
I'm good with leaving tsconfig
as-is then, but let's use relative path in the import statement, since that's what we use in docs.
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.
That's a good catch. The newer version of Next.js auto generated the relative path as default, so I kept it here
@@ -0,0 +1,13 @@ | |||
// @ts-nocheck |
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.
Why is @ts-nocheck
necessary?
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.
otherwise there would be a lot of red marks in VS Code.
That might be a good point. Would that prevent some necessary build failures if there's any TS issue?
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.
since we're interested in catching TS errors, let's remove it.
<AccountSettings.ChangePassword onSuccess={() => {}} /> | ||
<AccountSettings.DeleteUser onSuccess={() => {}} /> | ||
<StorageManager | ||
acceptedFileTypes={['image/*']} |
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.
Nit, but spacing seems off. Can you run prettier?
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.
Done 3f68159
push: | ||
branches: [main] # Run when merge to main |
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.
Should we run this on push
? I don't see much value in this, because build-system-tests
will test against @latest
, not the commit that was just merged.
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.
Oh, that might be my mis-understanding. I thought push
on main
is publish to @latest
😂
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.
push
on main
is by default publish to @next
unless the commit is from "Version Packages" PR. In either way, we would have to wait until publish-next
finishes to run build test against it.
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.
Done b645eeb
build-system-tests/templates/components/react/next/template-tsconfig-11.json
Show resolved
Hide resolved
"next": "^11.1.3", | ||
"react": "17", | ||
"react-dom": "17", | ||
"typescript": "5.0.3" |
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.
Is typescript
meant to be pinned?
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.
Good catch. I'll test and address it in the real PR
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.
Done 3f68159
{({ signOut, user = { username: '' } }) => ( | ||
<main> | ||
<h1>Hello {user.username}</h1> |
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.
What about
{({ signOut, user = { username: '' } }) => ( | |
<main> | |
<h1>Hello {user.username}</h1> | |
{({ signOut, user }) => ( | |
<main> | |
<h1>Hello {user.username}</h1> |
to mimic our documentation code?
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.
or user?.username
if above isn't TS strict compliant.
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.
Our docs would have a type error. We have to either set a default value or add a question mark like user?.username
😂
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.
Let's add a question mark for now. Let's add a ticket for updating our docs for TS strict customers.
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.
Done 3f68159
Description of changes
TODO:
Issue #, if available
Description of how you validated changes
Tested on fork's build:![Mega App Canary - React](https://github.com/0618/amplify-ui/actions/workflows/mega-app-tests-react.yml/badge.svg)
PoC PR on fork: 0618#20
PoC PR in this repo: #3751
Checklist
yarn test
passessideEffects
field updatedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.