thaliproject / Thali_CordovaPlugin

Thali p2p plugin
MIT License
226 stars 44 forks source link

Test 'discoveryAdvertisingStateUpdateNonTCP is called' throws error on desktop #1913

Closed jareksl closed 7 years ago

jareksl commented 7 years ago

testThaliMobileNative.js - discoveryAdvertisingStateUpdateNonTCP is called throws an error even if the test itself is passing. The assertion fails even if passed err is undefined https://github.com/thaliproject/Thali_CordovaPlugin/blob/master/test/www/jxcore/bv_tests/testThaliMobileNative.js#L1239 See the log below. Full log accessible here https://raw.githubusercontent.com/ThaliTester/TestResults/1265037342651392_Added_skip_function_to_allow_a_test_to_be_skipped_over_jareksl/build.md:

36mok 136 Can call stopAdvertisingAndListening without error 2017-06-20 19:16:11 - ERROR CoordinatedClient: 'unexpected result, error: 'Error', stack: 'Error at CoordinatedClient.unexpectedResult (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/lib/CoordinatedClient.js:584:13) at Test.emit (events.js:98:20) at Test.bound [as emit] (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/node_modules/tape/lib/test.js:62:32) at Test.assert (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/node_modules/tape/lib/test.js:245:10) at Test.bound [as _assert] (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/node_modules/tape/lib/test.js:62:32) at Test.notOk.Test.false.Test.notok (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/node_modules/tape/lib/test.js:309:10) at Test.bound (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/node_modules/tape/lib/test.js:62:32) at MobileCallInstance. (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/bv_tests/testThaliMobileNative.js:1239:15) at callbackWrapper (/Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/lib/wifiBasedNativeMock.js:199:29) at /Users/thali/Github/Thali_CordovaPlugin/test/www/jxcore/lib/wifiBasedNativeMock.js:471:7 at Array.0 (/Users/thali/Github/Thali_CordovaPlugin/thali/node_modules/lie/lib/index.js:88:21) at nextTick (/Users/thali/Github/Thali_CordovaPlugin/thali/node_modules/immediate/lib/index.js:61:18) at process._tickCallback (node.js:924:13)', original result: '{"id":11,"ok":true,"name":"Can call stopAdvertisingAndListening without error","operator":"notOk","expected":false}''

teardown

39m 2017-06-20 19:16:11 - DEBUG UnitTestFramework: '#run ok: 'discoveryAdvertisingStateUpdateNonTCP is called''

enricogior commented 7 years ago

Same problem on iOS:

2017-06-22 14:12:33 - INFO CoordinatedClient: '***TEST_LOGGER result: failed - unknown, error: 'Error', stack: 'CoordinatedClient.prototype.unexpectedResult@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/lib/CoordinatedClient.js:584:13
emit@events.js:98:1
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
assert@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:245:5
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
Test.prototype.notok@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:309:1''
2017-06-22 14:12:33 - INFO CoordinatedClient: '***TEST_LOGGER result: failed - unknown, error: 'Error', stack: 'CoordinatedClient.prototype.unexpectedResult@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/lib/CoordinatedClient.js:584:13
emit@events.js:98:1
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
assert@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:245:5
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
Test.prototype.notok@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:309:1''
2017-06-22 14:12:33 - INFO CoordinatedClient: '***TEST_LOGGER result: failed - unknown, error: 'Error', stack: 'CoordinatedClient.prototype.unexpectedResult@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/lib/CoordinatedClient.js:584:13
emit@events.js:98:1
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
assert@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:245:5
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
Test.prototype.notok@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:309:1''
2017-06-22 14:12:33 - INFO CoordinatedClient: '***TEST_LOGGER result: failed - unknown, error: 'Error', stack: 'CoordinatedClient.prototype.unexpectedResult@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/lib/CoordinatedClient.js:584:13
emit@events.js:98:1
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
assert@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:245:5
bound@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:62:28
Test.prototype.notok@/private/var/containers/Bundle/Application/06D7FD54-483E-4BE8-B1EC-F18C22193565/ThaliTest.app/www/jxcore/node_modules/tape/lib/test.js:309:1''
2017-06-22 14:12:33 - INFO CoordinatedClient: '***TEST_LOGGER result: passed - discoveryAdvertisingStateUpdateNonTCP is called'
2017-06-22 14:12:33 - ERROR CoordinatedClient: 'failed to run unit tests, platformName: 'ios''
2017-06-22 14:12:33 - DEBUG CoordinatedClient: 'all tests completed'
2017-06-22 14:12:33 - DEBUG CoordinatedClient: 'test client disconnected'
2017-06-22 14:12:33 - DEBUG CoordinatedClient: 'test client succeed'
2017-06-22 14:12:33 - DEBUG CoordinatedThaliTape: 'all tests succeed'
2017-06-22 14:12:33 - DEBUG CoordinatedThaliTape: '****TEST_LOGGER:[PROCESS_ON_EXIT_SUCCESS]****'
2017-06-22 14:12:33 - INFO runTests: 'Finished'

1..82
# tests 82
# pass  82

# ok
lesn1kk commented 7 years ago

The assertion is ok, it fails because I believe this assertion is called after t.end(). We need to make it as promises, and when all of them will resolve, call t.end()