Should you be testing platform code generated by Capacitor? #4463
-
Adding a platform into capacitor creates a folder for that platform with an actual project with actual source code that was all generated for you. From what I can tell, it is recommended to commit this into source control and maintain it ourselves. Sadly none of the generated code has any tests generated for it. Should I add tests in the relevant language for the code that was generated? For example Bonus question: What happens if in the future the generated code gets changed, how would I get that into my project? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
We recommend to commit the native projects, that way you can make any changes on them, in example, if you want to integrate some SDK that recommends adding some code in Both native projects have the minimum code for Capacitor apps to work, there is nothing to test. Whenever we update the templates, we document the changes you need to make in your project in the upgrade guides, usually only on major releases, unless they are optional changes, so you can follow the guides, or if you didn't make any changes in the project, you can remove ios/android folders and add the platforms back, but will require to at least re set the app version/version code |
Beta Was this translation helpful? Give feedback.
We recommend to commit the native projects, that way you can make any changes on them, in example, if you want to integrate some SDK that recommends adding some code in
MainActivity.java
orAppDelegate.swift
. Also the app version/version code is stored in the native project.Both native projects have the minimum code for Capacitor apps to work, there is nothing to test.
On Android it's just an Activity that extends
BridgeActivity
.On iOS the main storyboard has a single view controller that has its class set to
CAPBridgeViewController
.Whenever we update the templates, we document the changes you need to make in your project in the upgrade guides, usually only on major releases, unless th…