Giter Site home page Giter Site logo

Comments (7)

maksimr avatar maksimr commented on August 9, 2024

@brianmhunt thanks! Good point

from karma-mocha.

pkozlowski-opensource avatar pkozlowski-opensource commented on August 9, 2024

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.

brianmhunt avatar brianmhunt commented on August 9, 2024

@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.

pkozlowski-opensource avatar pkozlowski-opensource commented on August 9, 2024

@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.

brianmhunt avatar brianmhunt commented on August 9, 2024

@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.

brianmhunt avatar brianmhunt commented on August 9, 2024

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.

dignifiedquire avatar dignifiedquire commented on August 9, 2024

@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)

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.