NativeScript / NativeScript/nativescript-cli

Extended Android Activity crashes unit-test-runner

Abierto
#5,608 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

os: android unit testing
Lenguaje dominante
JavaScript
Estrellas
1.1k
Forks
204
Merge medio
1 d 9 h
PR fusionados (30 d)
8

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con ns create ns-test --ts, una actividad de Android extendida, ns test init y ns test android. Empieza rastreando cómo nativescript-unit-test-runner sobrescribe webpack y resuelve activity.android.ts; el trabajo estará terminado cuando las pruebas unitarias se ejecuten correctamente con una actividad de Android extendida presente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, javascript, typescript
Área
cli, mobile, testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.