Mailing List Archive

Fwd: Re: Code coverage for JavaScript testing?
Hi Greg,

actually I'm more interested in creating the coverage reports on a local dev box in the context of extension development / local CI (checking the coverage of newly created JS tests). I did find info about running JS tests but little to nothing about coverage. Maybe I missed something.

/Alexander

Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
> On Tue, Oct 26, 2021 at 2:31 AM planetenxin <planetenxin@web.de <mailto:planetenxin@web.de>> wrote:
>
> Is there a generic approach, how to get some coverage reports for the JavaScript parts of MW and MW extensions?
>
>
> Is https://doc.wikimedia.org/cover/ <https://doc.wikimedia.org/cover/> helpful in your case?
>
> --
> | Greg Grossmeier              GPG: B2FA 27B1 F7EB D327 6B8E |
> | Dir. Engineering Productivity     A18D 1138 8E47 FAC8 1C7D |
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Fwd: Re: Code coverage for JavaScript testing? [ In reply to ]
I recommend using Jest <https://mediawiki.org/wiki/Vue.js/Testing> for unit
testing with code coverage.

In various Vue.js extensions including NearbyPages
<https://github.com/wikimedia/mediawiki-extensions-NearbyPages> we use Jest
which is recommended by the Vue.js migration team.

An alternative approach is to use QUnit. In MobileFrontend and Popups we
use a command line version of QUnit. It’s not tied to Webpack in any way
despite the title (it would work with packageFiles these days). (
https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports
)

When using command line unit testing you'll need to use
@wikimedia/mw-node-qunit <https://github.com/wikimedia/mw-node-qunit> for
providing a mock MediaWiki environment. Despite the name this library can
be used with Jest (see NearbyPages for an example).

Hope this is helpful!

On Wed, Oct 27, 2021 at 7:51 AM planetenxin <planetenxin@web.de> wrote:

>
> Hi Greg,
>
> actually I'm more interested in creating the coverage reports on a local
> dev box in the context of extension development / local CI (checking the
> coverage of newly created JS tests). I did find info about running JS tests
> but little to nothing about coverage. Maybe I missed something.
>
> /Alexander
>
> Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
> > On Tue, Oct 26, 2021 at 2:31 AM planetenxin <planetenxin@web.de <mailto:
> planetenxin@web.de>> wrote:
> >
> > Is there a generic approach, how to get some coverage reports for
> the JavaScript parts of MW and MW extensions?
> >
> >
> > Is https://doc.wikimedia.org/cover/ <https://doc.wikimedia.org/cover/>
> helpful in your case?
> >
> > --
> > | Greg Grossmeier GPG: B2FA 27B1 F7EB D327 6B8E |
> > | Dir. Engineering Productivity A18D 1138 8E47 FAC8 1C7D |
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Fwd: Re: Code coverage for JavaScript testing? [ In reply to ]
There's also the https://github.com/wikimedia-gadgets/mock-mediawiki
project which provides a more comprehensive mock mediawiki environment,
best used with Jest (though it can be used with any test runner).

On Thu, 28 Oct 2021 at 06:00, Jon Robson <jrobson@wikimedia.org> wrote:

> I recommend using Jest <https://mediawiki.org/wiki/Vue.js/Testing> for
> unit testing with code coverage.
>
> In various Vue.js extensions including NearbyPages
> <https://github.com/wikimedia/mediawiki-extensions-NearbyPages> we use
> Jest which is recommended by the Vue.js migration team.
>
> An alternative approach is to use QUnit. In MobileFrontend and Popups we
> use a command line version of QUnit. It’s not tied to Webpack in any way
> despite the title (it would work with packageFiles these days). (
> https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports
> )
>
> When using command line unit testing you'll need to use
> @wikimedia/mw-node-qunit <https://github.com/wikimedia/mw-node-qunit> for
> providing a mock MediaWiki environment. Despite the name this library can
> be used with Jest (see NearbyPages for an example).
>
> Hope this is helpful!
>
> On Wed, Oct 27, 2021 at 7:51 AM planetenxin <planetenxin@web.de> wrote:
>
>>
>> Hi Greg,
>>
>> actually I'm more interested in creating the coverage reports on a local
>> dev box in the context of extension development / local CI (checking the
>> coverage of newly created JS tests). I did find info about running JS tests
>> but little to nothing about coverage. Maybe I missed something.
>>
>> /Alexander
>>
>> Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
>> > On Tue, Oct 26, 2021 at 2:31 AM planetenxin <planetenxin@web.de
>> <mailto:planetenxin@web.de>> wrote:
>> >
>> > Is there a generic approach, how to get some coverage reports for
>> the JavaScript parts of MW and MW extensions?
>> >
>> >
>> > Is https://doc.wikimedia.org/cover/ <https://doc.wikimedia.org/cover/>
>> helpful in your case?
>> >
>> > --
>> > | Greg Grossmeier GPG: B2FA 27B1 F7EB D327 6B8E |
>> > | Dir. Engineering Productivity A18D 1138 8E47 FAC8 1C7D |
>> _______________________________________________
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
>>
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
Re: Fwd: Re: Code coverage for JavaScript testing? [ In reply to ]
Hi folks, many thanks for your hints and helpful links!

Am 28.10.2021 um 02:29 schrieb Jon Robson:
> I recommend using Jest <https://mediawiki.org/wiki/Vue.js/Testing> for unit testing with code coverage.
>
> In various Vue.js extensions including NearbyPages <https://github.com/wikimedia/mediawiki-extensions-NearbyPages> we use Jest which is recommended by the Vue.js migration team.
>
> An alternative approach is to use QUnit. In MobileFrontend and Popups we use a command line version of QUnit. It’s not tied to Webpack in any way despite the title (it would work with packageFiles these days). (https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports <https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports>)
>
> When using command line unit testing you'll need to use @wikimedia/mw-node-qunit <https://github.com/wikimedia/mw-node-qunit> for providing a mock MediaWiki environment. Despite the name this library can be used with Jest (see NearbyPages for an example).
>
> Hope this is helpful!
>
> On Wed, Oct 27, 2021 at 7:51 AM planetenxin <planetenxin@web.de <mailto:planetenxin@web.de>> wrote:
>
>
> Hi Greg,
>
> actually I'm more interested in creating the coverage reports on a local dev box in the context of extension development / local CI (checking the coverage of newly created JS tests). I did find info about running JS tests but little to nothing about coverage. Maybe I missed something.
>
> /Alexander
>
> Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
> > On Tue, Oct 26, 2021 at 2:31 AM planetenxin <planetenxin@web.de <mailto:planetenxin@web.de> <mailto:planetenxin@web.de <mailto:planetenxin@web.de>>> wrote:
> >
> >     Is there a generic approach, how to get some coverage reports for the JavaScript parts of MW and MW extensions?
> >
> >
> > Is https://doc.wikimedia.org/cover/ <https://doc.wikimedia.org/cover/> <https://doc.wikimedia.org/cover/ <https://doc.wikimedia.org/cover/>> helpful in your case?
> >
> > --
> > | Greg Grossmeier              GPG: B2FA 27B1 F7EB D327 6B8E |
> > | Dir. Engineering Productivity     A18D 1138 8E47 FAC8 1C7D |
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org <mailto:wikitech-l@lists.wikimedia.org>
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org <mailto:wikitech-l-leave@lists.wikimedia.org>
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/ <https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/>
>
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>


--
________________________________________________
semantic::core go!
Free Enterprise Class MediaWiki Distribution
https://semantic.wiki/de/core
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/