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

Contribution Question - How to run plugin unit tests #2248

Open
akanda-via opened this issue Nov 19, 2024 · 0 comments
Open

Contribution Question - How to run plugin unit tests #2248

akanda-via opened this issue Nov 19, 2024 · 0 comments

Comments

@akanda-via
Copy link

Bug Report

I am new to iOS development and I see that the plugins here are using the SPM template rather than the CocoaPods one.
I would like to know how a contributor could add unit tests to any of these plugins and run them - ideally without a host/example app.

What is the expected developer setup and workflow when working on an iOS plugin in isolation?

Plugin(s)

All plugins in this repo, though using filesystem as an example.

Capacitor Version

Run from capacitor-plugins/filesystem

$ npx cap doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 6.1.2
  @capacitor/core: 6.1.2
  @capacitor/android: 6.1.2
  @capacitor/ios: 6.1.2

Installed Dependencies:

  @capacitor/cli: not installed
  @capacitor/core: not installed
  @capacitor/android: not installed
  @capacitor/ios: not installed

Platform(s)

iOS

Current Behavior

No (obvious) way to run existing placeholder unit tests.

Expected Behavior

Some sort of test command like npm test or ./gradlew test equivalent to run all iOS unit tests and accompanying setup instructions (or a link to them).

Code Reproduction

cd filesystem
swift test

Results in errors like:

  1 | import Foundation
  2 | import Capacitor
    |        `- error: no such module 'Capacitor'
  3 | 
  4 | @objc public class Filesystem: NSObject {

Other Technical Details

I couldn't run the tests in Xcode as I get this build error:

/Users/akanda/Library/Developer/Xcode/DerivedData/filesystem-fycybfztoqcatdftjshlbslyvbwn/SourcePackages/artifacts/capacitor-swift-pm/Capacitor/Capacitor.xcframework:1:1 While building for macOS, no library for this platform was found in '/Users/akanda/Library/Developer/Xcode/DerivedData/filesystem-fycybfztoqcatdftjshlbslyvbwn/SourcePackages/artifacts/capacitor-swift-pm/Capacitor/Capacitor.xcframework'.

I could successfully run npm run verify:ios, but that only builds.

Additional Context

If this is something obvious, then perhaps all that's needed is a contributions documentation update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants