Closed sg552 closed 9 years ago
ti-mocha is for running tests in the Titanium runtime, meaning on a device or a simulator/emulator. Trying to run them via mocha
at the CLI doesn't make sense in this context. You run the tests like you would run any Titanium app, like titanium build -p ios
or via Titanium Studio.
lib
folder somewhere, there's no specific convention. It's your job to invoke the tests, so you can do it anywhere.titanium build
to run the titanium app once you have your tests set up.thanks Tony, I will check it out~
@tonylukasavage , this is working for unit cases. I am trying use istanbul for code coverage for the same ti-mocha test cases. Could you help me in achieving this?
@sg552 @tonylukasavage If this is not achievable , please let me know any code coverage tools which uses ti-mocha test cases . Do you have any idea regarding this ?
@sg552 can you please explain how to implement ti mocha in Alloy project..
I am not using Titanium for 2 year. I am using native Android/iOS now. because native language is easier to debug ,to maintain , and for people in China, there're very few people knowing Titanium.
so, @Deepdhee11 I don't know how to use mocha in Alloy. @vklakshman1808 sorry I don't know. I almost forgot Titanium programming now... Orz
good luck guys, for people in China, we have only 2 options:
hi Tony,
My team is using Titanium SDK 3.5, now it's time for me to add unit tests to it. However, I am not able to run the "Basic Usage" in the document, nor the "Titanium + mocha + should example".
For the Basic Usage example, I did the following steps:
step1.1. $ npm install ti-mocha ( after that, app/lib/ti-mocha.js appears) step1.2. $ touch my_test.js , add content to it,
setp1.3. then
$ mocha my_test.js
, error appeard:So I head for the more detailed example: Titanium + mocha + should example, also I met problems:
step2.1. I create a file named 'app.js' in the root of my project folder. content is:
step2.2. I created a test file in: test/test_app.js:
step2.3 then I run: $ mocha ( in the root of my project folder )
Neither of the example runs as my expect. I think I must miss something.
My question is:
$ cd <my_titanium_project> && mocha
? or something else?thanks Siwei