generator-ionic icon indicating copy to clipboard operation
generator-ionic copied to clipboard

grunt test not functioning

Open mistermoses opened this issue 10 years ago • 7 comments

On a newly generated project, grunt test doesn't run the tests and just goes to the Waiting... message (as if I had run grunt serve). It will capture a file change and come back to the Waiting... message, but it still doesn't run the tests. We have replicated this issue on linux and mac. Here is the terminal output:

$ grunt test Running "clean:dist" (clean) task Cleaning .tmp...OK

Running "clean:server" (clean) task

Running "concurrent:test" (concurrent) task

Warning: There are more tasks than your concurrency limit. After this limit is reached no further tasks will be run until the current tasks are completed. You can adjust the limit in the concurrent task options

Running "copy:styles" (copy) task


Done, without errors.


Execution Time (2014-11-06 22:10:32 UTC)
loading tasks  11ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 37%
copy:styles    18ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 60%
Total 30ms

Running "copy:vendor" (copy) task


Done, without errors.


Execution Time (2014-11-06 22:10:35 UTC)
loading tasks  12ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 36%
copy:vendor    19ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 58%
Total 33ms

Running "compass:dist" (compass) task
directory .tmp/styles
    write .tmp/styles/main.css (0.004s)

Running "compass:server" (compass) task

Done, without errors.


Execution Time (2014-11-06 22:10:33 UTC)
compass:dist     1.3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 56%
compass:server  958ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 43%
Total 2.2s

Running "copy:fonts" (copy) task
Copied 4 files

Done, without errors.


Execution Time (2014-11-06 22:10:37 UTC)
loading tasks  10ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇ 26%
copy:fonts     27ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 71%
Total 38ms

Running "autoprefixer:dist" (autoprefixer) task Prefixed file ".tmp/styles/main.css" created.

Running "karma:unit:start" (karma) task

Running "watch:karma" task

Running "watch" task Waiting...

mistermoses avatar Nov 06 '14 22:11 mistermoses

I encountered today that Karma just prints "Done, without errors." and tests are not run after creating initial project - tried different templates also without success - and running "grunt karma:unit" or "grunt karma". I took Jasmine to use and tests are running okay.

Also I had to delete trailing comma after last parameter for karma:continuous task in file Gruntfile.js ("singleRun: true," - comma is an error, as it's the last property).

I could try creating a patch if needed. Would switching to Jasmine be option? It's currently the most popular.

kveskimae avatar Nov 07 '14 20:11 kveskimae

Removing that comma got my tests to run, and I'm actually finding now that I like Mocha quite a bit. Thanks.

mistermoses avatar Nov 08 '14 14:11 mistermoses

Looks like even if the tests run, they're broken. No matter which sample app I generate, it seems that the example tests always asserts the following:

scope.pets.should.have.length(4);

...which doesn't seem to exist in all of the different generated project types (tabs, sidemenu, etc)

jrodenbostel avatar Jan 30 '15 15:01 jrodenbostel

I have the same problem that tests are always green even they are incorrect. Removing comma does not solve the problem. Could you please share your solution?

maks-rafalko avatar Feb 08 '15 19:02 maks-rafalko

@borNfreee I changed the assertion in question to:

scope.friends.should.have.length(4);

Which works with the tabs version of the app. The assertions should be different based on the app template, or, they should all use the 'pets' objects.

jrodenbostel avatar Feb 10 '15 18:02 jrodenbostel

@jrodenbostel thanks I've found an issue. Could you please elaborate on terminology. After fresh install of the project, what is the describe function? is it Jasmine? if no, what is it? As I understand this generator uses Chai as a default assertion library. Is that correct?

maks-rafalko avatar Feb 10 '15 20:02 maks-rafalko

I'm seeing similar issues, however on my fresh install I don't have anything inside the /test directory other than a .jshintrc. I thought the generator included some demo tests?

kynetiv avatar Feb 11 '15 16:02 kynetiv