MortenHoustonLudvigsen / KarmaTestAdapter

A Visual Studio test explorer adapter for Karma
MIT License
20 stars 14 forks source link

The adapter does not work with karma configuration files not called karma.conf.js #15

Closed MortenHoustonLudvigsen closed 9 years ago

MortenHoustonLudvigsen commented 9 years ago

As uncovered in #13.

MortenHoustonLudvigsen commented 9 years ago

@cResults Would it be possible to rename karma.conf.src.js to karma.conf.js temporarily. Just to see whether the name is the problem?

cResults commented 9 years ago

Both currently exist. karma.conf is configured to run against our minimized and compiled JavaScript that is deployed, while karma.conf.src runs against the source files and is great for debugging.

Would changing it to something else be of assistance?

MortenHoustonLudvigsen commented 9 years ago

@cResults I am making a test project with a Karma configuration file named karma.conf.src.js as we speak. This should help me track down this error.

cResults commented 9 years ago

I removed "karmaConfigFile": "karma.conf.src.js", from KarmaTestAdapter.json which should run against the default karma.conf and I receive:

[karma] [Projects\Source\Web\ui] Creating KarmaTestContainer for Projects\Source\Web\ui\KarmaTestAdapter.json
[karma] [Projects\Source\Web\ui] Watching Projects\Source\Web\ui\KarmaTestAdapter.json
[karma] [Projects\Source\Web\ui] Watching Projects\Source\Web\ui\KarmaTestAdapter.json
[karma] [Projects\Source\Web\ui] KarmaTestContainer created
------ Discover test started ------
[karma] [Projects\Source\Web\ui] [Karma] [karma]: starting karma server
[karma] [Projects\Source\Web\ui] [Karma] [VS Reporter]: Created
[karma] Refreshing containers: Karma started for Projects\Source\Web\ui
[karma] [Projects\Source\Web\ui] [Karma] [VS Server]: Started - port: 53023
========== Discover test finished: 810 found (0:00:06.7373465) ==========
------ Discover test started ------
[karma] [Projects\Source\Web\ui] [Discover] Discovering tests

It starts discovering tests, but never starts Chrome nor does it finish finding tests.

cResults commented 9 years ago

before that I tried changing the name of karm.conf.src to karm.confsrc. Change the name of the file and changed the KarmaTestAdapter.KarmaConfigFile.

cResults commented 9 years ago

When I add "KarmaConfigFile": "karma.conf.src.js", back in, I rec'd:

[karma] [Warning] [Projects\Source\Web\ui] Karma configuration file not found: karma.conf.src.js
MortenHoustonLudvigsen commented 9 years ago

I think I have resolved the naming issue. The vsix file can be downloaded here: https://github.com/MortenHoustonLudvigsen/KarmaTestAdapter/releases/download/v1.0.1-issue-15/KarmaTestAdapter.vsix It has version 1.0.1, so if a version 1.0.1 is already installed in Visual Studio, it needs to be uninstalled before installing this prerelease.

MortenHoustonLudvigsen commented 9 years ago

@cResults A more comprehensive log can be found here: %LOCALAPPDATA%\2PS\KarmaTestAdapter\KarmaTestAdapter.log

cResults commented 9 years ago

I'm getting the "Extension is already installed" error from the vsix

cResults commented 9 years ago

I'm sorry I didn't read your whole message. Uninstalling and reinstalling 1.0.1

cResults commented 9 years ago

Here's the current output:

[karma] [Projects\Source\Web\ui] Creating KarmaTestContainer for Projects\Source\Web\ui\KarmaTestAdapter.json
[karma] [Projects\Source\Web\ui] Watching Projects\Source\Web\ui\KarmaTestAdapter.json
[karma] [Warning] [Projects\Source\Web\ui] Karma configuration file not found: Projects\Source\Web\ui\karma.conf.src.js
------ Discover test started ------
========== Discover test finished: 810 found (0:00:06.7193014) ==========

Here's the log file. I edited out a bunch of entries that said "Finding sources for ..." which exist for every project in our solution.

[13.03.2015 17:09:00.301] KarmaTestContainerDiscoverer created
...
[13.03.2015 17:09:01.094] [Debug] Finding sources for Web
[13.03.2015 17:09:01.226] [Projects\Source\Web\ui] Creating KarmaTestContainer for Projects\Source\Web\ui\KarmaTestAdapter.json
[13.03.2015 17:09:01.564] [Projects\Source\Web\ui] Watching Projects\Source\Web\ui\KarmaTestAdapter.json
[13.03.2015 17:09:01.625] [Warning] [Projects\Source\Web\ui] Karma configuration file not found: Projects\Source\Web\ui\karma.conf.src.js
MortenHoustonLudvigsen commented 9 years ago

Right, I've updated the prerelease to log the reason the configuration file is not found - i.e. whether the file does not exist or whether it is not included in the project.

cResults commented 9 years ago

I uninstalled and reinstalled from this link https://github.com/MortenHoustonLudvigsen/KarmaTestAdapter/releases/download/v1.0.1-issue-15/KarmaTestAdapter.vsix

and the output and log look the same as my prior post.

Please let me know if there is something else I can do.

In the meantime, I'm going to trying running tests from a basic non-Require js web project and see if I can get them to run from there. Then I'll try my paired down project. If it fails there, I'll upload it for you to use.

MortenHoustonLudvigsen commented 9 years ago

@cResults If you are able to reproduce in a paired down project, that would be wonderful! If you can, would it be possible to add it to the TestProjects folder of this project in a pull request?

MortenHoustonLudvigsen commented 9 years ago

I have updated the prerelease again: https://github.com/MortenHoustonLudvigsen/KarmaTestAdapter/releases/tag/v1.0.1-issue-15

Identification of test containers has been improved:

MortenHoustonLudvigsen commented 9 years ago

@cResults Come to think of it, it would be a big help if you would clone this repository (branch issue-15), and see if the adapter works with the test projects in TestProjects/TestProjects.sln.

MortenHoustonLudvigsen commented 9 years ago

@cResults I think I have resolved the issues you have raised here. Specifically:

So, I have decided to publish version 1.0.1, and close this issue. However, I am still very interested in hearing the results of your tests, and if possible to see a paired down project. And I will still do my best to resolve further issues you experience.

cResults commented 9 years ago

Hey Morten,

I'm sorry that I was unavailable over the weekend. I've updated two work stations to 1.0.2 and ran against a project configured the same as the solution I've been working in but only includes smoke tests.

On one it cycles through a loop of restarting karma multiple times and never stops. OUTPUT:

[karma] [KarmaRequireJasmine/ui] Creating KarmaTestContainer for ui\KarmaTestAdapter.json
[karma] [KarmaRequireJasmine/ui] Watching ui\KarmaTestAdapter.json
[karma] [KarmaRequireJasmine/ui] Watching ui\karma.conf.src.js
[karma] [KarmaRequireJasmine/ui] KarmaTestContainer created
[karma] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[karma] [KarmaRequireJasmine/ui] [Warning] Karma stopped - exit code: 0
[karma] [KarmaRequireJasmine/ui] [Warning] Restarting karma
[karma] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[karma] [KarmaRequireJasmine/ui] [Warning] Karma stopped - exit code: 0
[karma] [KarmaRequireJasmine/ui] [Warning] Restarting karma
[karma] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[karma] [KarmaRequireJasmine/ui] [Warning] Karma stopped - exit code: 0
[karma] [KarmaRequireJasmine/ui] [Warning] Restarting karma

KarmaServer:

[2015-03-16 14:08:43.610] [INFO] karma - starting karma server

KarmaTestAdapter LOG File:

[16.03.2015 14:01:42.907] KarmaTestContainerDiscoverer created
[16.03.2015 14:01:43.414] [Debug] Finding sources for KarmaRequireJasmine
[16.03.2015 14:01:43.428] [KarmaRequireJasmine/ui] Creating KarmaTestContainer for ui\KarmaTestAdapter.json
[16.03.2015 14:01:43.616] [KarmaRequireJasmine/ui] Watching ui\KarmaTestAdapter.json
[16.03.2015 14:01:43.619] [KarmaRequireJasmine/ui] Watching ui\karma.conf.src.js
[16.03.2015 14:01:45.439] [KarmaRequireJasmine/ui] [Debug] [Server] NODE_PATH: e:\Projects\KarmaRequireJasmine\KarmaRequireJasmine\ui\node_modules;C:\Users\David\AppData\Roaming\npm\node_modules
[16.03.2015 14:01:45.448] [KarmaRequireJasmine/ui] [Debug] [Server] Starting Karma: node C:\USERS\DAVID\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\12.0\EXTENSIONS\2VSCFXQ3.NAF\lib\Start.js --karma karma.conf.src.js --settings KarmaTestAdapter.json
[16.03.2015 14:01:45.458] [KarmaRequireJasmine/ui] KarmaTestContainer created
[16.03.2015 14:01:46.547] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[16.03.2015 14:01:46.804] [KarmaRequireJasmine/ui] [Warning] Karma stopped - exit code: 0
[16.03.2015 14:01:46.813] [KarmaRequireJasmine/ui] [Warning] Restarting karma
[16.03.2015 14:01:49.163] [KarmaRequireJasmine/ui] [Debug] [Server] NODE_PATH: e:\Projects\KarmaRequireJasmine\KarmaRequireJasmine\ui\node_modules;C:\Users\David\AppData\Roaming\npm\node_modules
[16.03.2015 14:01:49.172] [KarmaRequireJasmine/ui] [Debug] [Server] Starting Karma: node C:\USERS\DAVID\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\12.0\EXTENSIONS\2VSCFXQ3.NAF\lib\Start.js --karma karma.conf.src.js --settings KarmaTestAdapter.json
[16.03.2015 14:01:50.116] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[16.03.2015 14:01:50.370] [KarmaRequireJasmine/ui] [Warning] Karma stopped - exit code: 0
[16.03.2015 14:01:50.376] [KarmaRequireJasmine/ui] [Warning] Restarting karma

On the other, the progress bar in Test Explorer continues to cycle and never displays tests. OUTPUT:

------ Discover test started ------
[karma] [KarmaRequireJasmine/ui] [Discover] Discovering tests

KarmaServer LOG File:

[2015-03-16 14:20:54.028] [INFO] karma - starting karma server
[2015-03-16 14:20:54.243] [INFO] VS Reporter - Created
[2015-03-16 14:20:54.273] [INFO] VS Server - Started - port: 64056

KarmaTestAdapter Log File:

[16.03.2015 14:20:45.627] KarmaTestContainerDiscoverer created
[16.03.2015 14:20:50.592] [Debug] Finding sources for KarmaRequireJasmine
[16.03.2015 14:20:50.604] [KarmaRequireJasmine/ui] Creating KarmaTestContainer for ui\KarmaTestAdapter.json
[16.03.2015 14:20:50.772] [KarmaRequireJasmine/ui] Watching ui\KarmaTestAdapter.json
[16.03.2015 14:20:50.773] [KarmaRequireJasmine/ui] Watching ui\karma.conf.src.js
[16.03.2015 14:20:53.026] [KarmaRequireJasmine/ui] [Debug] [Server] NODE_PATH: d:\Projects\KarmaRequireJasmine\KarmaRequireJasmine\ui\node_modules;C:\Users\dsmith\AppData\Roaming\npm\node_modules
[16.03.2015 14:20:53.029] [KarmaRequireJasmine/ui] [Debug] [Server] Starting Karma: node C:\USERS\DSMITH\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\12.0\EXTENSIONS\NGEPDDRC.UYX\lib\Start.js --karma karma.conf.src.js --settings KarmaTestAdapter.json
[16.03.2015 14:20:53.032] [KarmaRequireJasmine/ui] KarmaTestContainer created
[16.03.2015 14:20:54.032] [KarmaRequireJasmine/ui] [Karma] [karma]: starting karma server
[16.03.2015 14:20:54.257] [KarmaRequireJasmine/ui] [Karma] [VS Reporter]: Created
[16.03.2015 14:20:54.280] [KarmaRequireJasmine/ui] [Debug] Karma started using port 64056
[16.03.2015 14:20:54.485] Refreshing containers: Karma started for KarmaRequireJasmine/ui
[16.03.2015 14:20:54.486] [KarmaRequireJasmine/ui] [Karma] [VS Server]: Started - port: 64056
[16.03.2015 14:20:56.937] [Debug] Finding sources for KarmaRequireJasmine
[16.03.2015 14:21:00.257] [KarmaRequireJasmine/ui] [Discover] Discovering tests

Please advise what you would like me to do.

MortenHoustonLudvigsen commented 9 years ago

Hey David

Would it be possible for you to share your project with me? It would be great if you could add it to TestProjects/TestProjects.sln and make a pull request. Alternatively you could zip it and send to mlu at 2ps.dk. Hopefully I will be able to reproduce the issue.

/Morten