[Wikitech-l] Re: Fwd: Re: Code coverage for JavaScript testing?

2021-10-28 Thread planetenxin

Hi folks, many thanks for your hints and helpful links!

Am 28.10.2021 um 02:29 schrieb Jon Robson:

I recommend using Jest  for unit 
testing with code coverage.

In various Vue.js extensions including 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 
 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 mailto:planeten...@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 mailto:planeten...@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/  
> 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-le...@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-le...@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-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Fwd: Re: Code coverage for JavaScript testing?

2021-10-27 Thread Siddharth VP
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  wrote:

> I recommend using Jest  for
> unit testing with code coverage.
>
> In various Vue.js extensions including 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  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  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 > > 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/ 
>> 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-le...@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-le...@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-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Fwd: Re: Code coverage for JavaScript testing?

2021-10-27 Thread Jon Robson
I recommend using Jest  for unit
testing with code coverage.

In various Vue.js extensions including 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  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  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  planeten...@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/ 
> 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-le...@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-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/