Comments (7)
@brianmhunt thanks! Good point
from karma-mocha.
Actually, I think that a reporter is the way to go. If we simply hack around mocha global than the mentioned speech reporter will work only with mocha. If we wrap it as a proper reporter, than people can use it with any testing framework (jasmine, qunit etc.)
@brianmhunt not sure why you are saying that writing a dedicated reporter is an overkill - actually one can write such a reporter in < 10 LOC, have a look at the existing reporters, ex.:
https://github.com/karma-runner/karma-growl-reporter/blob/d172e212d985dd781e786dc3e099122a8a19d366/index.js#L47-L63
from karma-mocha.
@pkozlowski-opensource perhaps this will help explain why I think a package is overkill (though having mucked around with it a bit, I think that you are probably right ... just here are my concerns):
I am not sure karma-growl-reporter is a good example of a package not being overkill. The index.js
is 70 lines of code and the package includes at least 8 other files, as well as a repository on GitHub and registration on npm. Perhaps one can write a reporter in <10 LOC, karma-growl-reporter illustrates the problem: The bulk of that package is unnecessary boilerplate, packaging, and additional responsibility that does not advance the desired functionality. I don't want any of that; I just want a hook when the mocha test runner ends, and I am sure there are others similarly situated. Since speech synthesis in HTML5 is trivial, it should be trivial to hook it to any test runner by exposing their hooks, too, if so desired.
There are additional challenges to a generic speech synthesis reporter. For example, the growl reporter works from node, not the HTML5/browser, meaning that one would have to find a multi-platform speech synthesis method for the speech synthesis if one were to mimic the growl reporter. (I am sure it's out there, but I have never seen it). I am sure Karma provides a hook to execute something in the browser when mocha tests end (how would the hook know?), but I am not sure it would be as simple as the guts of the growl package. As well, a full-blown package would need to either be re-published for every mundane changes (e.g. to the text being spoken) or alternatively have additional configuration settings built-in and respected by the package.
There may be a simple package that can achieve this, but maybe it's because I am new to Karma, because it seems fairly daunting - compared to the alternative of just exposing the runner (though I am not sure just exposing the runner is enough since one still needs to add a hook for the call when tests end). It would be great to be proven otherwise. 😁
from karma-mocha.
@brianmhunt what you are saying makes sense from your personal point of view. As Karma maintainer, though, I'm often taking a perspective of a community member. From this angle files like package.json etc. and not boilerplate but essential files to share packages with various developers.
I think we should encourage reusable packages created and shared by the community. If everyone would only take personal point of view, things like Karma wouldn't even exist... Vojta put a lot of effort making Karma working for cases that he doesn't need and I would like to continue in this spirit.
But even in your personal case, you don't have to create a new package etc. If you want to keep your reporter for yourself, just create it in your project and register with Karma. But won't you need it in your next project soon?
from karma-mocha.
@pkozlowski-opensource You're absolutely right.
The cost of learning karma for this one trivial function, plus maintaining another open source project (I have a few in my stable 😄), is somewhat daunting for me personally. But if I do figure out how to do it, I'll likely share a generic speech reporter.
from karma-mocha.
I have since created karma-speech-reporter, and found karma-say-reporter, which I feel resolve this issue.
Closing, but feel free to re-open if this feels like an itch to scratch. :)
from karma-mocha.
@brianmhunt thanks for mentioning it, sounds cool. If it's ready feel free to drop a PR to the main repo adding it to the docs/plus section :)
from karma-mocha.
Related Issues (20)
- Passed --grep option persists across test runs HOT 1
- npm test - Uncaught ReferenceError: describe is not defined HOT 3
- No provider for "framework:mocha"! (Resolving: framework:mocha) HOT 11
- karma tests slowed down with mocha 4
- Applying polyfill before loading mocha HOT 6
- Can I keep tests in a normal mocha index.html? HOT 3
- Delay __karma__.start() until es6 test modules have been loaded HOT 1
- maintainers and status of project HOT 4
- Usage of exact version of minimist HOT 4
- When will commit: 36404cf36aa5150f839c98d10baa8c642faad098 will be relaesed? HOT 1
- Uncaught exception: emitting a 'test end' event for a hook HOT 1
- Redundant Mocha Reporter Node <div id="mocha"></div> HOT 1
- Uncaught exceptions in between Mocha tests are not reported HOT 2
- Support for mocha root hooks
- adapter.js swallows failures that occur after test complete
- Unit tests are missing when `script type="module"` takes >= 3ms before `describe` HOT 1
- Reestablish CI/CD with GitHub Actions
- The dependency minimist "^1.2.3" is declared as vulnerable need to update to 1.2.6 or more HOT 1
- Status of this project? HOT 4
- Analysis: 76% of dependency updates in this repository can be merged.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-mocha.