GithubHelp home page GithubHelp logo

Comments (21)

AlexanderLea avatar AlexanderLea commented on June 27, 2024 1

Thanks so much for your help and patience :)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Hi @AlexanderLea , are you using Angular or just Karma? if its angular could you provide me with a test project to reproduce the bug?. the test loader currently does not supports standalone karma, only karma inside of Angular. It will be supported very soon though, as it doesn't require too much work to happen.

PS: the test explorer is called Angular/Karma cause its difficult to change the name after published. And also its gonna happen very soon ahha. It is already in the planned features mentioned in the README.md :)

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Using within Angular 7.

Might well be test volume - we have nearly 2800 tests.

Works fine on a ng new empty Angular project.

Will work on a repro :)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

@AlexanderLea might be, to be honest I only have around 1500. could you also open developer tools and check if there is an error or log in there?

Thanks a lot for your feedback!

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Ah - I've got a stack trace and error in the console.

I can't see anything related specifically to my code in here. @Raagh are you able to pass your eyes over it?

No worries for the feedback - thanks for writing the extension! We are super excited to be able to use it :)

[Extension Host] Starting Angular tests with arguments: test --karma-config="C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\config\test-explorer-karma.conf.js"
log.ts:173

ERR listen EADDRINUSE :::1111: Error: listen EADDRINUSE :::1111
at Server.setupListenHandle [as _listen2] (net.js:1330:14)
at listenInCluster (net.js:1378:12)
at Server.listen (net.js:1466:7)
at listenTillKarmaReady.resolve (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\workers\karma\karma-event-listener.js:46:25)
at new Promise ()
at KarmaEventListener.listenTillKarmaReady (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\workers\karma\karma-event-listener.js:22:16)
at KarmaRunner. (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\workers\karma\karma-runner.js:15:43)
at Generator.next ()
at __awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:107:75)
at new Promise ()
at Object.__awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:103:16)
at KarmaRunner.waitTillKarmaIsRunning (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\workers\karma\karma-runner.js:14:24)
at AngularTestExplorer. (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\angular-test-explorer.js:25:36)
at Generator.next ()
at __awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:107:75)
at new Promise ()
at Object.__awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:103:16)
at AngularTestExplorer.loadTests (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\angular-test-explorer.js:17:24)
at Adapter. (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\adapter.js:34:57)
at Generator.next ()
at __awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:107:75)
at new Promise ()
at Object.__awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:103:16)
at Adapter.load (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\adapter.js:31:24)
at TestHub.registerTestAdapter (C:\Users\alexander.lea.vscode\extensions\hbenl.vscode-test-explorer-2.8.1\out\hub\testHub.js:56:17)
at Object.registerTestAdapter (C:\Users\alexander.lea.vscode\extensions\hbenl.vscode-test-explorer-2.8.1\out\main.js:53:45)
at TestAdapterRegistrar.add (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\vscode-test-adapter-util\out\registrar.js:45:22)
at new TestAdapterRegistrar (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\vscode-test-adapter-util\out\registrar.js:19:22)
at C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\main.js:19:40
at Generator.next ()
at __awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:107:75)
at new Promise ()
at Object.__awaiter (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\tslib\tslib.js:103:16)
at activate (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\out\main.js:9:20)
at Function._callActivateOptional (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:691:166)
at Function._callActivate (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:690:870)
at define._doActivateExtension.Promise.all.then.e (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:690:79)
console.ts:134

ERR spawn ng ENOENT: Error: spawn ng ENOENT
at notFoundError (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\alexander.lea.vscode\extensions\raagh.angular-karma-test-explorer-1.0.0\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Seems to me that you already have a server running on port 1111 (or something using that port). I use this port for a socket connection between the custom karma reporter and the test explorer. In order to show the results of the tests in the UI.

could you check if this is the case? I will definitely make that value configurable.

If you also wanna make sure that's the issue please feel free to clone the repo following this steps
Contributing Guidelines

and change port here

and here

this.socket = io("http://localhost:1111/");

I will try to reproduce it tonight when I get home myself

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Cool - I'll give it a go.

I set up a new project earlier, and I didn't get any errors running on the same machine - surely that would've also failed on the port issue?

A.

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

yes unless that port is being used by the angular application itself (or a backend for that angular app), but I guess you would have noticed that. its weird that node complains exactly about that "ERR listen EADDRINUSE :::1111: Error: listen EADDRINUSE :::1111"

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Checked out the project, and ran in debug (the new port didn't make a difference - still fails).

Got a different error - does this one shed any light?

stack trace: SyntaxError: Unexpected token  in JSON at position 0
extensionHostProcess.js:700
at JSON.parse ()
at C:\Users\alexander.lea.vscode\extensions\christian-kohler.path-intellisense-1.4.2\out\src\utils\config.js:20:25
Starting Angular tests with arguments: test --karma-config="C:\Users\alexander.lea\Documents\GitHub\angular-karma_test-explorer\out\config\test-explorer-karma.conf.js"
logger.js:6
Listening to AngularReporter events on port 65535
logger.js:6
Sync : Connected with user : 'AlexanderLea'
extension.js:14
Error: An extension called process.exit() and this was prevented.
extensionHostProcess.js:696
at process.define.constructor.process.exit (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:696:801)
at gracefulExit (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\winston\lib\winston\exception-handler.js:194:17)
at module.exports (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\async\internal\once.js:12:16)
at iteratorCallback (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\async\eachOf.js:60:13)
at module.exports (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\async\internal\onlyOnce.js:12:16)
at onetime (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\one-time\index.js:23:16)
at File.module.exports._uncaughtException.asyncForEach (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\winston\lib\winston\exception-handler.js:213:11)
at Object.onceWrapper (events.js:273:13)
at File.emit (events.js:187:15)
at File.logged (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\winston\lib\winston\transports\file.js:130:12)
at afterWrite (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\readable-stream\lib_stream_writable.js:491:3)
at process._tickCallback (internal/process/next_tick.js:63:19)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Not really, though now the error is indeed further in the code, before the extension was unable to create a socket on port 1111. now the server successfully started listening on port 65535 as the log says : "Listening to AngularReporter events on port 65535"

could you upload a test project for me so I can debug it and see where the error comes from?

do you have path.intellisense extension installed right? cause the error seems to be triggered there.

https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense

SyntaxError: Unexpected token  in JSON at position 0
extensionHostProcess.js:700
at JSON.parse ()
at C:\Users\alexander.lea.vscode\extensions\christian-kohler.path-intellisense-1.4.2\out\src\utils\config.js:20:25

could you try uninstalling that extension and running everything again?
are you sure that stack is from my extension and not from that other extension? cause i see a lot of my logs mixed up with stuff that its not mine.

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Uninstalled and get the same extension error - less peripheral errors tho. Here's the stack here. Maybe I'll try deleting all extensions (or a fresh install somewhere) and then give it a go.

Here's a stack with fewer other errors

2019-03-26T16:29:54.530Z - debug: [TypescriptHero] Setting up extension and activatables.
logger.js:45
2019-03-26T16:29:54.531Z - debug: [ImportOrganizer] Setting up ImportOrganizer.
logger.js:45
2019-03-26T16:29:54.536Z - debug: [TypescriptHero] Starting up extension and activatables.
logger.js:45
2019-03-26T16:29:54.537Z - info: [ImportOrganizer] Starting up ImportOrganizer.
logger.js:45
starting server on port 8888
start-server.ts?:56
Listening on port 8888
start-server.ts?:61
Starting Angular tests with arguments: test --karma-config="C:\Users\alexander.lea\Documents\GitHub\angular-karma_test-explorer\out\config\test-explorer-karma.conf.js"
logger.js:6
Listening to AngularReporter events on port 65535
logger.js:6
Sync : Connected with user : 'AlexanderLea'
extension.js:14
Error: An extension called process.exit() and this was prevented.
extensionHostProcess.js:696
at process.define.constructor.process.exit (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:696:801)
at gracefulExit (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\winston\lib\winston\exception-handler.js:194:17)
at module.exports (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\async\internal\once.js:12:16)
at iteratorCallback (C:\Users\alexander.lea.vscode\extensions\rbbit.typescript-hero-3.0.0\node_modules\async\eachOf.js:60:13)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Indeed it might be good to try that same project( with the installed extension) on another computer or fresh install to rule out any outside interference.

If you can prepare that test project for me I will be happy to help :)

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Any more information on this?

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Closed due to lack of information

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Hi,

Sorry for lack of contact - holiday/busy etc.

I've got a fresh install with no extensions, and getting different errors with the latest code from git:

Starting Angular tests with arguments: test --karma-config="c:\Users\alexander.lea\Documents\GitHub\angular-karma_test-explorer\out\config\test-explorer-karma.conf.js" --progress=false
logger.js:6

Listening to AngularReporter events on port 9999
logger.js:6

error from ng child process: Error: spawn ng ENOENT
logger.js:6`

Any suggestions? I'm gonna struggle to do a real test project (corporate rules etc), but will give it a go tonight.

Alex

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

No worries! okey lets start:

Some things I learned about the project while you were gone.
The project does not support hybrid apps( angular + angularJs).
Also does not support apps which don't follow the regular angular-cli structure(one angular.json in the root, one project and one karma.conf.js).
Also does not support root projects with 2 or more projects inside( lets say and app and a component library).

So please make sure your project is not one of this types. all this types of projects are being addressed in this branch: https://github.com/Raagh/angular-karma_test-explorer/tree/feature/support-multiple-apps

but it still not ready. If this is not your case then keep reading so we figure out whats going on.

please make sure you have the last master downloaded without any changes. also make sure you did npm install in your project and that doing ng test successfully runs tests inside your project.

after that if you have this 2 lines not commented:

this.angularProcess.stderr.on("data", (data: any) => this.logger.log(`stderr: ${data}`));

you should get errors from the spawn process. the error you got is basically telling you that something failed when launching ng test. with those 2 two lines not commented you should see more errors related to the problem.

open developer tools inside vscode to check every error you get related to this :)

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Hey,

So if I run ng test I get the fairly standard "JavaScript heap out of memory" error (angular/angular-cli#5613).

If I run node --max_old_space_size=4096 "./node_modules/@angular/cli/bin/ng" test then I get a successful test run. I can't see any option that would allow me to set extra params/change the command instead of ng test.

Debugging with that line uncommented, I get the following error, which looks like it doesn't like my karma.conf.js?

stdout: 15 04 2019 15:44:38.660:ERROR [config]: Error in config file! 
 { Error: Cannot find module 'c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\karma.conf.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at KarmaConfigurator.loadOriginalUserConfiguration (c:\Users\alexander.lea\Documents\GitHub\angular-karma_test-explorer\src\config\karma-configurator.ts:59:32)
    at module.exports (c:\Users\alexander.lea\Documents\GitHub\angular-karma_test-explorer\src\config\test-explorer-karma.conf.ts:18:21)
    at Object.parseConfig (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\karma\lib\config.js:393:5)
    at new Server (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\karma\lib\server.js:66:24)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\src\karma\packages\angular_devkit\build_angular\src\karma\index.ts:103:29)
    at Observable._trySubscribe (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\Observable.ts:224:19)
    at Observable.subscribe (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\Observable.ts:205:14)
    at c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\util\subscribeTo.ts:22:23
    at Object.subscribeToResult (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\util\subscribeToResult.ts:25:29)
    at MergeMapSubscriber._innerSub (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\operators\mergeMap.ts:145:5)
    at MergeMapSubscriber._tryNext (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\operators\mergeMap.ts:138:10)
    at MergeMapSubscriber._next (c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\node_modules\@angular-devkit\build-angular\node_modules\rxjs\src\internal\operators\mergeMap.ts:122:12) code: 'MODULE_NOT_FOUND' }

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

okey, So i am guessing that after fixing the karma error will still not work cause there is something already wrong with your enviroment, ng test should work on your project for this to work. I like the idea of adding a config value for extra parameters though. I will try to implement it in future updates.

But lets try to fix the karma issue first, is actually your karma.conf there?

for a regular angular-cli project the karma.conf.js should be inside the src folder, so what the current version of my code does is first it looks it inside: c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\src\karma.conf.js if its not there it will look it up in the root c:\Users\alexander.lea\Documents\Git\NextGen\InveniasWebApp\karma.conf.js. if its not there it will fail. which is your case, so where exactly is your karma.conf?

the test explorer is basically not finding your karma.conf in the 2 default positions for an angular-cli project.

from angular-karma_test-explorer.

AlexanderLea avatar AlexanderLea commented on June 27, 2024

Hi,

I feel stupid - karma.conf.js was buried in a /configs directory. I've moved back to the route and now I'm getting the out of memory exception from ng test.

If I change ln 55 of angular-server.ts to be:
const commonArgs = ["test", --karma-config="${baseKarmaConfigFilePath}", "--progress=false", "--sourceMap=false"];

... then it works (angular runs out of memory generating the sourcemaps).

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

Awesome!, we dont really need the source maps so I will make sure to include that code with next update.

Also about the config don't worry, the multi-apps branch I showed you will read the path of the karma.conf from the angular.json so hopefully for next version your scenario will be fully supported :). I will comment here to let you know when that happens

from angular-karma_test-explorer.

Raagh avatar Raagh commented on June 27, 2024

No worries, thank you for downloading the extension and take the time with bug

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.