Neurologically Paralyzing Mouseovers

    qunitx

    0.3.6 • Public • Published

    QUnitX

    Experimental improvements, suggestions for qunit CLI

    QunitX terminal output

    Default test output is TAP (Test-Anything-Protocol) thus you can use any tap reporter of your choice to display test output in anyway you like. Example:

    # using it with tap-difflet TAP reporter:
    qunitx tests/attachments tests/user | npx tap-difflet

    Installation:

    npm install -g qunitx
    
    qunitx

    In order to use qunitx to execute existing qunit tests please change:

    import { module, test } from 'qunit';
    
    // to:
    import { module, test } from 'qunitx';

    Example:

    // in some-test.js: (typescript is also supported for --browser mode)
    import { module, test } from 'qunitx';
    import $ from 'jquery';
    
    module('Basic sanity check', function (hooks) {
      test('it works', function (assert) {
        assert.equal(true, true);
      });
    
      module('More advanced cases', function (hooks) {
        test('deepEqual works', function (assert) {
          assert.deepEqual({ username: 'izelnakri' }, { username: 'izelnakri' });
        });
        test('can import ES & npm modules', function (assert) {
          assert.ok(Object.keys($));
        });
      });
    });
    # you can run the test in node with ES modules package.json{ "type": "module" }
    $ qunitx some-test.js
    
    # Suggested mode: if you want to run it in CI/google chrome:
    
    $ qunitx some-test.js --browser
    
    # with browser output enabled:
    
    $ qunitx some-test.js --browser --debug

    Code coverage

    QUnitX runner on node.js mode(without --browser) supports code coverage with c8, the best coverage tool in existence at the moment:

    c8 qunitx test/attachments test/user
    

    You can browse c8 documentation for all configuration options.

    Implementing code coverage for the browser mode is currently not possible because we use esbuild --bundle feature to create a JS bundles for testing in the browser, this could be instrumented with puppeteer-to-istanbul however instrumentation includes transpiled npm imports of qunitx and other potential npm imports developer includes in the code, this cannot be filtered since potential filtering can only occur after the esbuild bundling. When chrome browser and puppeteer fully supports ES asset maps we can remove esbuild from the browser mode, run everything in deno and make instrumentation for code coverage possible with the default v8 instrumentation.

    Esbuild plugin interface is an ongoing development, we might be able to figure out a way to generate this instrumentation with esbuild in the future, which could allow code coverage for --browser mode.

    Install

    npm i qunitx

    DownloadsWeekly Downloads

    0

    Version

    0.3.6

    License

    MIT

    Unpacked Size

    324 kB

    Total Files

    39

    Last publish

    Collaborators

    • izelnakri