New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@matvp91/webrun

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matvp91/webrun

`webrun`'s goal is to provide a _lightweight_ CLI tool that runs your integration tests effectively in a local environment. While there's many alternatives out there, its main focus is on testing the integration of a library you've built in order to ensur

latest
npmnpm
Version
1.0.8
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

webrun

webrun's goal is to provide a lightweight CLI tool that runs your integration tests effectively in a local environment. While there's many alternatives out there, its main focus is on testing the integration of a library you've built in order to ensure that you ship a working module.

  • Spins up a local webserver, hosting an integration sample of your module.
  • Uses the webdriver protocol and a strict API to provide interop between your local, remotely controlled browser and the test file.

Getting started

npm install @matvp91/webrun

Create the following structure in your project:

- /integration-tests // We'll use this folder name to write the test files.
  - /public // Will be served by a local webserver.
    - index.html
  - basic.test.js // Your test file.
// basic.test.js
module.exports = {
  name: 'A basic integration test',
  run: async (/* typeof Browser */ browser) => {
    await browser.runFunction(() => {
      bootstrapMyModule();
    });
    
    // Example of an interop between the browser and the test scenario.
    const result = await browser.runFunction(() => window.I_GOT_CALLED);
    expect(result).toBe(true);
  },
};
<!-- public/index.html -->
<html>
  <body>
    <script>
      function bootstrapMyModule() {
        // Gets called by the test runner through browser.runFunction(...).
        // For the sake of this example, we'll assign a variable to window and
        // retrieve it in our test runner.
        window.I_GOT_CALLED = true;
      }
    </script>
  </body>
</html>
// package.json
// In order to run the scenario, "npm run test:integration"
{
  "scripts": {
    "test:integration": "webrun integration-tests"
  }
}

FAQs

Package last updated on 24 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts