Extended Android Activity crashes unit-test-runner

オープン
#5,608 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
android, javascript, typescript
領域
cli, mobile, testing

調査の方向性

ns create ns-test --ts、拡張された Android activity、ns test initns test android を使ってクラッシュを再現します。まず、nativescript-unit-test-runner が webpack をどのようにオーバーライドし、activity.android.ts を解決しているかを追跡します。拡張された Android activity が存在する場合に unit test が正常に実行されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

os: android unit testing

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

主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
8

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NativeScript/nativescript-cli のほかの issue

NativeScript/nativescript-cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。