lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 136 forks source link

Getting 0 tests completed after running clicker #178

Closed ronaksbhavsar closed 7 years ago

ronaksbhavsar commented 7 years ago

blob

lathonez commented 7 years ago

Please confirm you have performed the following steps:

git clone git@github.com:lathonez/clicker.git
cd clicker
npm install
npm test
ronaksbhavsar commented 7 years ago

yes i have followed above steps

ronaksbhavsar commented 7 years ago

still same

lathonez commented 7 years ago

paste the output of the following:

node --version

npm list -g --depth=0

ronaksbhavsar commented 7 years ago

image

ronaksbhavsar commented 7 years ago

please check above screenshot

lathonez commented 7 years ago

Should be fine I think.

Does npm start work ok?

ronaksbhavsar commented 7 years ago

yes it's working fine when i run npm start , I am new to karma and jasmine for ionic 2 .

ronaksbhavsar commented 7 years ago

@lathonez Hi, please update me if you have found anything

lathonez commented 7 years ago

Nothing concrete, sorry.

Try:

After you've done that:

npm cache clean

and these steps again.

If you want to try to debug it yourself, you need to figure out why no specs are being found.

This line here: https://github.com/lathonez/clicker/blob/master/src/test.ts#L36 is a good starting point

ronaksbhavsar commented 7 years ago

ok

lathonez commented 7 years ago

BEFORE you do that, can you paste the entire output of npm test.

Please copy and paste (no screenshot).

ronaksbhavsar commented 7 years ago

ok

ronaksbhavsar commented 7 years ago

@lholznagel I have updated node to 6.5.0 , Typescript is already 2.0.7 and installed node modules again. still same

ronaksbhavsar commented 7 years ago

before Upgrading Node

Clicker@2.3.0 test E:\ ng test --code-coverage

22 11 2016 14:51:02.051:WARN [karma]: No captured browser, open http://localhost:9876/ 22 11 2016 14:51:02.051:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/ 22 11 2016 14:51:02.051:INFO [launcher]: Launching browser Chrome with unlimited concurrency 22 11 2016 14:51:02.309:INFO [launcher]: Starting browser Chrome 22 11 2016 14:51:05.749:INFO [Chrome 56.0.2922 (Windows 10 0.0.0)]: Connected on socket /#lyKl8I9gcQo-HU7zAAAA with id 4991 5639

START:

Finished in 0.002 secs / 0 secs

SUMMARY: √ 0 tests completed

lathonez commented 7 years ago

Apply this diff for debug:

diff --git a/src/test.ts b/src/test.ts
index d12d17f..ca87bd3 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -33,7 +33,7 @@ Promise.all([
     );
   })
   // Then we find all the tests.
-  .then(() => require.context('./', true, /\.spec\.ts/))
+  .then(() => require.context('./pages/page2/'))
   // And load the modules.
   .then(context => context.keys().map(context))
   // Finally, start Karma to run the tests.

run again and paste the output

ronaksbhavsar commented 7 years ago

ok

lathonez commented 7 years ago

Apply the diff and paste the output of npm test.

On 22 Nov 2016 22:05, "ronaksbhavsar" notifications@github.com wrote:

How to debug tests?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lathonez/clicker/issues/178#issuecomment-262212019, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5tSJiJnim8MeELj8saPWfRFx6FzngTks5rAsxfgaJpZM4K5Jmc .

ronaksbhavsar commented 7 years ago

Still same E:\clicker>npm test

Clicker@2.3.0 test E:\clicker ng test --code-coverage

22 11 2016 16:43:39.118:WARN [karma]: No captured browser, open http://localhost:9876/ 22 11 2016 16:43:39.133:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/ 22 11 2016 16:43:39.133:INFO [launcher]: Launching browser Chrome with unlimited concurrency 22 11 2016 16:43:39.313:INFO [launcher]: Starting browser Chrome 22 11 2016 16:43:40.938:INFO [Chrome 56.0.2922 (Windows 10 0.0.0)]: Connected on socket /#_Jz5YATKLlf85fM7AAAA with id 3159 998

START:

Finished in 0.002 secs / 0 secs

SUMMARY: √ 0 tests completed

lathonez commented 7 years ago

try using ng-cli directly:

npm install -g angular-cli
ng new PROJECT_NAME
cd PROJECT_NAME
ng test
ronaksbhavsar commented 7 years ago

@lathonez can you please help me out from this issue?

ronaksbhavsar commented 7 years ago

Hi @lathonez , I have created new project by given commands. and logs are given below:

Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.

E:\CLI-testProject>ng test 25 11 2016 11:19:36.455:WARN [karma]: No captured browser, open http://localhost:9876/ 25 11 2016 11:19:36.465:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/ 25 11 2016 11:19:36.465:INFO [launcher]: Launching browser Chrome with unlimited concurrency 25 11 2016 11:19:36.465:INFO [launcher]: Starting browser Chrome 25 11 2016 11:19:42.818:INFO [Chrome 56.0.2922 (Windows 10 0.0.0)]: Connected on socket /#5G04u69L8P0zPFMUAAAA with id 6892 4662 Chrome 56.0.2922 (Windows 10 0.0.0): Executed 3 of 3 SUCCESS (0.433 secs / 0.423 secs)

ronaksbhavsar commented 7 years ago

image

ronaksbhavsar commented 7 years ago

it's working fine in mac. i have tested it

ronaksbhavsar commented 7 years ago

it's working fine it was throwing an exception in debugger

ronaksbhavsar commented 7 years ago

https://github.com/angular/angular-cli/issues/2125

ronaksbhavsar commented 7 years ago

image

ronaksbhavsar commented 7 years ago

thanks for your support

lathonez commented 7 years ago

I am away currently away. Will pick this up when I return. Sometime mid December.

On 25 Nov 2016 19:08, "ronaksbhavsar" notifications@github.com wrote:

angular/angular-cli#2125 https://github.com/angular/angular-cli/issues/2125

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/lathonez/clicker/issues/178#issuecomment-262934135, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5tSKeDvejaCD1zsIPZTTudC0x9YHU2ks5rBsG2gaJpZM4K5Jmc .

ronaksbhavsar commented 7 years ago

Hi, It's been Resolved

lathonez commented 7 years ago

Can you tell us what you did to resolve it?

ronaksbhavsar commented 7 years ago

image I have added this code for typescript to identify mime type for browser

andrewgy8 commented 7 years ago

For the lazy in karma.conf.js : mime: { 'text/x-typescript': ['ts', 'tsx'] }

lathonez commented 7 years ago

@andrewgy8 - should I be adding this to karma.conf.js?

andrewgy8 commented 7 years ago

I had the same issue as @ronaksbhavsar, and that seemed to do the trick. Edit: Yes.

lathonez commented 7 years ago

5c0ffeb (will push in a bit)

ronaksbhavsar commented 7 years ago

yes, you should add

ronaksbhavsar commented 7 years ago

@lathonez Why you blocked me into gitter into 'clicker ' room?

lathonez commented 7 years ago

I removed the room, no one uses it.

ronaksbhavsar commented 7 years ago

@lathonez ok, can i comment here for issues?

ronaksbhavsar commented 7 years ago

@lathonez Actually i want to debug protractor, do you know how to debug through visual studio code?

Wolfium commented 7 years ago

I can confirm that the mime type setting in karma already there in my 2 projects, one working and the other don't is not the solution.

I am thinking in something related with the libraries versions from angular saying 4.1.2, working one had 4.1.1 and after upgrade failing, it got 4.1.3 that is working properly.

Unfortunatly from the yarn upgrade I can't reproduce it now, both project have testing working properly. Anyway, just to notice output ng version from 0 test (having tests inside) run project:

@angular/cli: 1.0.1
node: 7.3.0
os: win32 x64
@angular/common: 4.1.2
@angular/compiler: 4.1.2
@angular/core: 4.1.2
@angular/forms: 4.1.2
@angular/http: 4.1.2
@angular/platform-browser: 4.1.2
@angular/platform-browser-dynamic: 4.1.2
@angular/router: 4.1.2
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.2

Hope this helps.

Regards