NativeScript / NativeScript/nativescript-cli

Extended Android Activity crashes unit-test-runner

Offen
#5,608 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

os: android unit testing
Vorherrschende Sprache
JavaScript
Sterne
1.1k
Forks
204
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
8

Beschreibung

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 8.1.4
  • Cross-platform modules: @nativescript/core 8.1.1
  • Android Runtime: 8.1.1

Describe the bug
the nativescript-unit-test-runner is overriding webpack such that the extended activity file (activity.android.ts) is not resolved causing
a crash:

...
System.err: Unable to instantiate activity ComponentInfo{org.nativescript.nstest/org.myApp.MainActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'org/myApp/MainActivity'
System.err: 
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.nstest/org.myApp.MainActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'org/myApp/MainActivity'
System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194)

...

To Reproduce

  1. create new app ns create ns-test --ts

  2. extend Android activity following the instructions here: https://docs.nativescript.org/advanced-concepts.html#extending-android-activity

  3. verify that the app runs as expected ns run android (the app runs without any problems)

  4. initialize tests ns test init and select jasmine

  5. run tests ns test android

  6. crash and burn

Expected behavior
That unit tests run, even in the presence of an extended android activity

Sample project
Can't, updating AndroidManifest is required

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Absturz mit ns create ns-test --ts, einer erweiterten Android-Aktivität, ns test init und ns test android. Beginne damit nachzuverfolgen, wie nativescript-unit-test-runner webpack überschreibt und activity.android.ts auflöst; die Aufgabe ist erledigt, wenn Unit-Tests erfolgreich ausgeführt werden, sobald eine erweiterte Android-Aktivität vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
android, javascript, typescript
Bereich
cli, mobile, testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.