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

(BSR) chore(env): little faster when opening terminal #7449

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bebstein-pass
Copy link
Contributor

Link to JIRA ticket: https://passculture.atlassian.net/browse/PC-XXXXX

J'ai :

  • pu tester unitairement les commandes
  • pu tester sur XCode

mais le build en ligne de commande échoue sur master et sur cette branche, donc j'ai pas pu tester que yarn ios:testing fonctionne et ajoute le certificat tout seul

Flakiness

If I had to re-run tests in the CI due to flakiness, I add the incident on Notion

Checklist

I have:

  • Made sure my feature is working on mobile (depending on relevance : real or virtual devices)
  • I am aware of all the best practices and respected them.

Best Practices

Click to expand These rules apply to files that you make changes to. If you can't respect one of these rules, be sure to explain why with a comment. If you consider correcting the issue is too time consuming/complex: create a ticket. Link the ticket in the code.
  • In the production code: remove type assertions with as (type assertions are removed at compile-time, there is no runtime checking associated with a type assertion. There won’t be an exception or null generated if the type assertion is wrong). In certain cases as const is acceptable (for example when defining readonly arrays/objects). Using as in tests is tolerable.
  • Remove bypass type checking with any (when you want to accept anything because you will be blindly passing it through without interacting with it, you can use unknown). Using any in tests is tolerable.
  • Remove non-null assertion operators (just like other type assertions, this doesn’t change the runtime behavior of your code, so it’s important to only use ! when you know that the value can’t be null or undefined).
  • Remove all @ts-expect-error and @eslint-disable.
  • Remove all warnings, and errors that we are used to ignore (yarn test:lint, yarn test:types, yarn start:web...).
  • Use gap (ViewGap) instead of <Spacer.Column />, <Spacer.Row /> or <Spacer.Flex />.
  • Don't add new "alias hooks" (hooks created to group other hooks together). When adding new logic, this hook will progressively become more complex and harder to maintain.
  • Remove logic from components that should be dumb.

Test specific:

  • Avoid mocking internal parts of our code. Ideally, mock only external calls.
  • When you see a local variable that is over-written in every test, mock it.
  • Prefer user to fireEvent.
  • When mocking feature flags, use setFeatureFlags. If not possible, mention which one(s) you want to mock in a comment (example: jest.spyOn(useFeatureFlagAPI, 'useFeatureFlag').mockReturnValue(true) // WIP_NEW_OFFER_TILE in renderPassPlaylist.tsx )
  • In component tests, replace await act(async () => {}) and await waitFor(/* ... */) by await screen.findBySomething().
  • In hooks tests, use act by default and waitFor as a last resort.
  • Make a snapshot test for pages and modals ONLY.
  • Make a web specific snapshot when your web page/modal is specific to the web.
  • Make an a11y test for web pages.

Advice:

  • Use TDD
  • Use Storybook
  • Use pair programming/mobs

`devShell` was legacy and deprecated
without this, the following command produces the next error

```sh
bundle exec pod install --repo-update
```

```txt
    WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8

bundler: failed to load command: pod (/Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/bin/pod)
Encoding::CompatibilityError: Unicode Normalization not appropriate for ASCII-8BIT
  /nix/store/inhgi4ksqzqnjk6v9fa49fgdf0zymmpn-ruby-2.7.5/lib/ruby/2.7.0/unicode_normalize/normalize.rb:141:in `normalize'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `unicode_normalize'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:166:in `installation_root'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/config.rb:226:in `podfile_path'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/user_interface/error_report.rb:30:in `report'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:66:in `report_error'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/claide-1.1.0/lib/claide/command.rb:396:in `handle_exception'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/claide-1.1.0/lib/claide/command.rb:337:in `rescue in run'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/claide-1.1.0/lib/claide/command.rb:324:in `run'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/bin/pod:25:in `load'
  /Users/eb/Project/pass-culture/pass-culture-app-native/.devbox/virtenv/ruby/bin/pod:25:in `<top (required)>'
```
to try to have faster direnv

and to do it at the right moment
XCode hardcode the PATH when building the app

XCode didn't find Node

XCode was requiring Node to be globally installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants