tidev/titanium-sdk

Android: Karma tests failling - Callsite/Stack issue

m1ga opened this issue · 0 comments

m1ga commented

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

Putting the Slack infos in here:

While testing the Karma part for ti.playservices I've found that node-titanium-sdk is behaving differently in the latest version
When you run (error test from the test suite)

try {
	Ti.Geolocation.accuracy = null
} catch (ex) {
	console.log(ex.stack)
}

it results in [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]

before it was

"Error: Unable to convert null
\n    at new Controller (/alloy/controllers/index.js:46:24)
\n    at Object.exports.createController (/alloy.js:427:8)
\n    at /app.js:29:7
\n    at Module._runScript (ti:/kroll.js:1346:15)
\n    at Module.load (ti:/kroll.js:829:13)
\n    at Module.loadJavascriptText (ti:/kroll.js:1192:15)
\n    at Module.loadAsFile (ti:/kroll.js:1244:22)
\n    at Module.loadAsFileOrDirectory (ti:/kroll.js:1163:26)
\n    at Module.require (ti:/kroll.js:974:30)
\n    at Module.global.Module.require (<embedded>:5053:32)"

I can pin it down to happen between 12.1.0.v20230116130958 and 12.1.0.v20230120162600. That was the node-titanium-sdk merge.
BUT: when I build a master with the old 5.1.6 I still see the problem :thinking_face:
That confuses me a bit, might be some build issue on my side.
Since the only "big" change in the version has been the node module package raise I suspect that one of the packages is the issue:
https://github.com/tidev/node-titanium-sdk/commit/70ae6bfc2c75896ccd19c04ebf90098ab667ab7e#diff-7ae45ad102eab3b6d7e789[…]b346470d7bc6507b6481575d519
Don't think the ndk error messages or eslint fixes are responsible.

I just can't test it. So it would be great if someone can test the following:

  • revert the package.json changes in node-titanium-sdk
  • npm i and use that node-titanium-sdk in 12.1.0 master
  • run the test code above (Android) and see if the output is the correct stack again

I can't even build a 12.0.0 (released version works fine) here without the issue 😞

before we make a 12.0.1 we should think about this one. I'm sure that a 12.0.1 build will have the same issue now as it might be a npm package that will install a newer version now.
Run the 4 lines of code with a 12.0.0 build on Android to check if the error output is correct.
It's not a big issue for me as I don't use ex.stack somewhere and the ex.message is still correct. I only found this running the test suite and karma tests in modules (jasmine looks for an error as a string and its an object).

https://www.diffchecker.com/C7VPEuqB/
diff of the package-lock files.
left: master - right: last working commit fc1e2e1
ioslib and node-titanium-sdk are the obvious changes but the child packages change a lot too. Babel/core 7.7.5 -> 7.20.12 and so on

after days of debugging I made a tiny step forward! At least I found the place where the error message is created: https://github.com/tidev/titanium_mobile/blob/ee64cd2d50add46b16c5de9e20607719cd35[…]/Resources/ti.internal/extensions/node/internal/util/inspect.js
and the CallSite stack is mentioned here: https://v8.dev/docs/stack-trace-api#customizing-stack-traces
just have to figure out now if that is something to fix in inspect.js 🙂

I'm sure the actual "error"/change is somewhere else but since I can't find it (tried many babel versions, babel modules, different node-titanium....) I thought it might be worth seeing if we can use the "new" version and try to make it spit out the error again and not just empty objects 😄

https://coolaj86.com/articles/callsite-get-your-stack-trace-back/

Platform

Android

SDK version you are using

12.1.0