npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aofl/unit-testing-plugin

v3.14.1

Published

Aofl unit testing plugin uses [WebdriverIO](https://webdriver.io/) to run unit tests in the browser.

Downloads

904

Readme

@aofl/unit-testing-plugin

Aofl unit testing plugin uses WebdriverIO to run unit tests in the browser.

Note: for automated browser testing refer to @aofl/wdio

Installation

npm i -D @aofl/unit-testing-plugin

If you plan on generating coverage report babel-plugin-istanbul is needed to instrument transpiled code. We recommend using babel-plugin-istanbul

Usage

const UnitTesting = require('@aofl/unit-testing-plugin');

module.export = {
  entry: {
    'custom-elements-es5-adapter': 'path/to/custom-e...',
    'init-polyfill-service': 'path/to/...'
  }.
  plugins: [
    new UnitTesting({
      root: process.cwd(), // project root
      output: '__build_tests',  // output directory of compiled test files.
      host: 'localhost',
      port: 3035,
      config: path.join(root, '.wct.config.js'),
      debug: false,
      nycArgs: [ // cli arguments passed to nyc to generate coverage report
        'report',
        '--reporter=lcov',
        '--reporter=text-summary',
        '--report-dir=./logs/coverage'
      ]
    })
  ]
}

WebdriverIO Configuration

For ease of use @aofl/unit-testing comes preconfigured with common WebdriverIO recipes. You can provide your own file based on https://webdriver.io/docs/configurationfile.html. However, in most cases you should only need to configure the capabilities field.

Local

// .wct.config.js
module.exports.config = {
  capabilities: [
    {
      "maxInstances": 5,
      "browserName": 'chrome',
      'goog:chromeOptions': {
        // to run chrome headless the following flags are required
        // (see https://developers.google.com/web/updates/2017/04/headless-chrome)
        args: ['--headless', '--disable-gpu'],
      }
    },
    {
      "maxInstances": 5,
      "browserName": 'firefox',
      'moz:firefoxOptions': {
        // flag to activate Firefox headless mode (see https://github.com/mozilla/geckodriver/blob/master/README.md#firefox-capabilities for more details about moz:firefoxOptions)
        args: ['-headless']
      },
    },
    // {
    //   "maxInstances": 10,
    //   "browserName": 'safari'
    // }
  ]
};

SauceLabs

Set SAUCE_USERNAME and SAUCE_ACCESS_KEY as environment variables.

// .wct-sauce.config.js
const sharedSettings = {
  recordLogs: true,
  recordVideo: true,
  recordScreenshots: false,
  timeout: 300,
  idleTimeout: 1000,
  commandTimeout: 600,
  webdriverRemoteQuietExceptions: false,
  videoUploadOnPass: false,
  tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || null // if using travis refer to https://docs.travis-ci.com/user/sauce-connect/
};

const config = {
  preset: 'sauce',
  specFileRetries: 1,
  sauceConnect: true,
  capabilities: [
    {
      ...sharedSettings,
      "browserName": "Safari",
      "appiumVersion": "1.15.0",
      "deviceName": "iPhone X Simulator",
      "platformVersion": "13.0",
      "platformName": "iOS"
    },
    ...
  ]
};