NativeScript / karma-nativescript-launcher

Karma launcher for NativeScript unit tests
Other
6 stars 3 forks source link

Filter stack traces #20

Open tailsu opened 8 years ago

tailsu commented 8 years ago

Exceptions contain a lot of extraneous stuff in the stack traces, which doesn't get filtered by the built-in filter, because the frameworks are loaded using eval().

Example from iOS runtime:

NativeScript / 8.1 (8.1; iPhone Simulator) A suite is just a function Check counter FAILED
    TypeError: undefined is not an object (evaluating 'mainViewModel.mainViewModel.HelloWorldModel.HelloWorldModel') in file:///app/tests/example.js (line 6)
    file:///app/tests/example.js:6:55
    attemptSync
    run
    execute
    queueRunnerFactory
    execute
    fn
    attemptAsync
    run
    execute
    queueRunnerFactory
    fn
    attemptAsync
    run
    execute
    queueRunnerFactory
    execute
    execute
    runTests@file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:224:23
    file:///app/tns_modules/nativescript-unit-test-runner/main-view-model.js:192:101
    tick@file:///app/tns_modules/timer/timer.js:16:23
    UIApplicationMain@[native code]
    start@file:///app/tns_modules/application/application.js:191:26
    anonymous@file:///app/tns_modules/nativescript-unit-test-runner/app.js:4:18
    __executeModule
    __loadModule
tailsu commented 8 years ago

If we stop using eval() and use require() instead, the built-in stack filtering in the framework adapters will do it for us.

ligaz commented 8 years ago

See https://github.com/NativeScript/ios-runtime/issues/392 for more details.