Partial regexp matching

kai zhu kaizhu256 at gmail.com
Thu Sep 6 01:23:51 UTC 2018


i have something, although not about partial-regexp-matching, could address the bigger-picture UX problem you have in testing.  i do frequent browser integration-tests with test-coverage, my standard-operating-procedure for pre-commits is to:

[1] run all tests with no url-based selector
https://kaizhu256.github.io/node-utility2/build..beta..travis-ci.org/app/?modeTest=1 <https://kaizhu256.github.io/node-utility2/build..beta..travis-ci.org/app/?modeTest=1>






[2] if issues arise, then re-run problematic tests with a url-search-parameter for further debugging.  here’s comma-separated example to select 2 problematic tests:
http://...?modeTestCase=_testCase_testRunDefault_failure,testCase_ajax_timeout)
https://kaizhu256.github.io/node-utility2/build..beta..travis-ci.org/app/?modeTest=1&modeTestCase=_testCase_testRunDefault_failure,testCase_ajax_timeout <https://kaizhu256.github.io/node-utility2/build..beta..travis-ci.org/app/?modeTest=1&modeTestCase=_testCase_testRunDefault_failure,testCase_ajax_timeout>



[3] and here’s real-world source-code for implementing the ?modeTestCase=... test-selector
https://github.com/kaizhu256/node-utility2/blob/2018.6.21/lib.utility2.js#L6817 <https://github.com/kaizhu256/node-utility2/blob/2018.6.21/lib.utility2.js#L6817>

```js
// read modeTestCase search-param from browser-url
switch (local.modeJs) {
case 'browser':
    location.search.replace(
        (/\b(NODE_ENV|mode[A-Z]\w+|timeExit|timeoutDefault)=([^&#]+)/g),
        function (match0, key, value) {
            match0 = decodeURIComponent(value);
            local[key] = local.env[key] = match0;
            // try to JSON.parse the string
            local.tryCatchOnError(function () {
                local[key] = JSON.parse(match0);
            }, local.nop);
        }
    );
    break;
...

// filter testCases with modeTestCase
Object.keys(options).forEach(function (key) {
    // add testCase options[key] to testPlatform.testCaseList
    if (typeof options[key] === 'function' && (local.modeTestCase
            ? local.modeTestCase.split(',').indexOf(key) >= 0
            : key.indexOf('testCase_') === 0)) {
        testPlatform.testCaseList.push({
            name: key,
            status: 'pending',
            onTestCase: options[key]
        });
    }
});

```

kai zhu
kaizhu256 at gmail.com



> On 15 Feb 2018, at 8:12 PM, Isiah Meadows <isiahmeadows at gmail.com> wrote:
> 
> I've been working on a test framework, and I'd love to implement
> support for matching tests via regexp-based selectors. It's basically
> impossible without the ability to execute a regular expression and
> test if it matched positively, negatively, or incompletely.
> 
> - If the regexp does not have an end marker, this, of course, can't
> generate a *negative* match, only positive/incomplete ones.
> - If the regexp *does* have an end marker, this is where I actually
> need native support. (This is especially true if group references get
> involved.)
> 
> Any chance this could get added?
> 
> -----
> 
> Isiah Meadows
> me at isiahmeadows.com
> 
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> www.isiahmeadows.com
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180906/08633b62/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2018-09-06 at 7.58.12 AM.jpg
Type: image/jpeg
Size: 282772 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180906/08633b62/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2018-09-06 at 8.00.05 AM.jpg
Type: image/jpeg
Size: 258098 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180906/08633b62/attachment-0003.jpg>


More information about the es-discuss mailing list