Giter Site home page Giter Site logo

Comments (12)

Raagh avatar Raagh commented on May 11, 2024 1

I see so no error there. If is not building of course it's not gonna work. Happy that in the end everything is working. Thank you for taking your time to follow on this problem, if you encounter something else don't doubt to let me know.

Have a nice day

from angular-karma_test-explorer.

Raagh avatar Raagh commented on May 11, 2024

Hi @IceBreakerG thank you for submitting the bug. I will try to reproduce it locally and do my best to solve it. Just to clarify, those logs you posted. So you opened the test explorer, app-angular-authentication started loading, you quickly changed the project to authentication, it didn't found any tests and then you switch back to app-angular-authentication everything in around 1 minute?. Could you describe to me your workflow or what are you trying to accomplish?

another question. how long does it take for you to run all the tests in each project by doing ng-test?

this is very strange: [3:47:26 PM] INFO: AngularReporter closed connection with event: transport close.

so transport close happens when chrome cuts the socket.io connection with vscode. There is currently a bug in karma that triggers this but you re seeing it way to often. That could also be the reason is taking to long, when this happen there is not other choice than to close the entire karma environment and start it again.

about this: Code lens for the tests is not showing up either. they don't appear for both project or one in particular? (I am wondering if the fact that you re running it on windows server has something to do with it, regarding the permission to check the file system)

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

Yes, after opening the folder in VS Code, I wait for the initialization to happen, and then switch to Test Explorer and change the project to authentication, and this is probably in less than a minute. The library project is just about finished, so I was making sure I had tests to cover the main functionality of the service.

As far as how long it takes to run the tests, it only takes a few seconds once everything is initialized. This is with the tests running in Chrome.

And as for Code lens, it's not showing up for any of the tests in this project (main app and library). I have another project where it does still show up though.

Earlier on, in one of my spec files, I had 2 tests that had the same description (ie. it('some description', () => {})). I'm not sure if that caused any issues though, but it was corrected when I saw it happening in the list. I'm not sure if runnin it on Windows Server is an issue or not either, I don't really have any control over that at the moment though. It's what we're stuck with at work for our development environment.

from angular-karma_test-explorer.

Raagh avatar Raagh commented on May 11, 2024

Okey good to know, I am creating the library now to see what happens.

About the tests, yes you cant have 2 tests with the same description. they will appear as faulty in the test explorer and probably they will not get codelenses.

About the time that it takes, they key thing you said is when everything initialize. What you got to understand is that everytime you change projects everything needs to be closed, and an 'ng test' command is run on the new selected project. So your building time and chrome start time is taking into account here, there is no way around it, Angular simply don't provide the option to execute the cli from outside the environment.

Apart from that running the tests from the test explorer should be as fast as when you do ng test, right? just running them I mean.

You gave me some ideas on how to improve the refreshing time though, they might be a chance to do an auto refresh of the tests when something changes( new test gets added or new spec file) without refreshing the whole environment. Also I am gonna try to look for the cause of that transport close you re getting which is definitely slowing done the process

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

About the tests, yes you cant have 2 tests with the same description. they will appear as faulty in the test explorer and probably they will not get codelenses.

I don't seem to be getting codelens for any of the tests in this particular project, even after fixing the test description, closing out VS Code, and re-opening it.

About the time that it takes, they key thing you said is when everything initialize. What you got to understand is that everytime you change projects everything needs to be closed, and an 'ng test' command is run on the new selected project. So your building time and chrome start time is taking into account here, there is no way around it, Angular simply don't provide the option to execute the cli from outside the environment.

I didn't know that. I have another application that has over 900 tests, and it seems to work well with that. It's just this library project application that doesn't want to play nice. I've also noticed, that when I run npm run test, which just runs ng test, it's actually trying to run tests for both projects, but not exactly at the same time. It starts running the tests for the main application, and when you press Ctrl+C to get out of it, it reloads and starts running the tests for the library project. I'm wondering if this is what's causing the hangup?

Apart from that running the tests from the test explorer should be as fast as when you do ng test, right? just running them I mean.

Yes, once the tests are loaded, they typically run very quickly. However, when I left work yesterday, the icon for reloading tests was spinning. When I got back this morning, it was still spinning. Seems like it just doesn't like having multiple projects with tests in them.

from angular-karma_test-explorer.

Raagh avatar Raagh commented on May 11, 2024

Hey Eric, so yesterday I found out why codelenses are not appearing in the library. A stupid hardcoded mistake on my part, I am looking for filepaths on src/app but the library will be on src/lib so that wont work... I will make sure to fix it for next release. Still that doesn't explain why you don't see codelenses on the regular project.

Your npm run test command is not the cause, although you re right about the default behaviour when I run my 'ng test' I specify the name of the project so when one project is selected only that one is being loaded.

I am also looking into some possible fixes for that 'transport close' issue, I cannot seem to get that error so its getting hard to try those fixes. if you re willing and you re still getting transport close I might ask you to clone one specific branch and run the code in your environment to see what happens. Do you get transport close if you just open vscode and load the project? or you only get it when you select a different project?

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

Hey Eric, so yesterday I found out why codelenses are not appearing in the library. A stupid hardcoded mistake on my part, I am looking for filepaths on src/app but the library will be on src/lib so that wont work... I will make sure to fix it for next release. Still that doesn't explain why you don't see codelenses on the regular project.

I just did a reboot on my dev machine (also had to install some Windows updates), and after logging back in, when I open up VS Code, after all of my extensions initialize, when I click on the Test Explorer icon, codelens is displaying on the main application spec files, and the tests for the main application are displaying in the list. When I switch to the library project, I get the following:

[8:30:48 AM] ERROR: error from ng child process: Error: spawn ng ENOENT
[8:30:48 AM] INFO: Angular exited succesfully
[8:30:48 AM] INFO: Starting Angular test enviroment for project: authentication
[8:31:19 AM] INFO: Test loading completed

I am also looking into some possible fixes for that 'transport close' issue, I cannot seem to get that error so its getting hard to try those fixes. if you re willing and you re still getting transport close I might ask you to clone one specific branch and run the code in your environment to see what happens. Do you get transport close if you just open vscode and load the project? or you only get it when you select a different project?

I did not get a transport close error when opening, just when changing the project. But it didn't happen the first time I changed the project, only after selecting my library project a second time.

from angular-karma_test-explorer.

Raagh avatar Raagh commented on May 11, 2024

New version supports discovering tests from libraries. Also fixed some problems with the codelenses and cleanup the logging because it was generating confusion with what is an error and what is normal karma behavior.

Let me know if everything works for you

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

I got the new version, and Codelens is showing up in the library tests now. Switching between projects did not load the tests for the main app until I build the library package though. Looks like the other issues I had are good now. Thanks!

from angular-karma_test-explorer.

Raagh avatar Raagh commented on May 11, 2024

Hi @IceBreakerG I am happy that is working for you. Can you explain to me what you mean? if you do 'ng test' you don't have to build the library first?.

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

There was an import error in the main app's spec file. My project is structured like this:

  • projects
    • authentication
      • src/lib/AuthenticationModule
  • src
    • app
      • Components and AppModule
      • In spec, `import { AuthenticationModule } from 'authentication'
        • This was giving an error until I built the package separately, as it didn't know where authentication was. This was on a different machine, so nothing had been built yet.

from angular-karma_test-explorer.

IceBreakerG avatar IceBreakerG commented on May 11, 2024

No problem, thanks for getting it fixed so quickly!

from angular-karma_test-explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.