Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wdio/runner

Package Overview
Dependencies
Maintainers
3
Versions
637
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wdio/runner

A WebdriverIO service that runs tests in arbitrary environments

  • 9.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548K
decreased by-15.76%
Maintainers
3
Weekly downloads
 
Created

What is @wdio/runner?

@wdio/runner is a core package of the WebdriverIO test framework. It is responsible for running the test suite, managing the lifecycle of the WebDriver sessions, and handling the execution of test scripts. It provides a robust and flexible environment for running automated tests across different browsers and devices.

What are @wdio/runner's main functionalities?

Running Test Suites

This code demonstrates how to run a test suite using the @wdio/runner package. It sets up the configuration for the test run, including the test specs, browser capabilities, log level, test framework, and reporters. The `run` function is then called with the configuration, and the process exits with the appropriate exit code based on the test results.

const { run } = require('@wdio/runner');

const config = {
  specs: ['./test/specs/**/*.js'],
  capabilities: [{ browserName: 'chrome' }],
  logLevel: 'info',
  framework: 'mocha',
  reporters: ['spec'],
};

run(config).then(
  (exitCode) => process.exit(exitCode),
  (error) => {
    console.error('Error:', error);
    process.exit(1);
  }
);

Managing WebDriver Sessions

This example shows how to manage WebDriver sessions using the @wdio/runner package. The configuration specifies the use of Firefox as the browser and Jasmine as the test framework. The `run` function handles the lifecycle of the WebDriver sessions, ensuring that they are properly started and terminated during the test run.

const { run } = require('@wdio/runner');

const config = {
  specs: ['./test/specs/**/*.js'],
  capabilities: [{ browserName: 'firefox' }],
  logLevel: 'info',
  framework: 'jasmine',
  reporters: ['dot'],
};

run(config).then(
  (exitCode) => process.exit(exitCode),
  (error) => {
    console.error('Error:', error);
    process.exit(1);
  }
);

Customizing Test Execution

This code sample demonstrates how to customize test execution using the @wdio/runner package. The configuration includes additional options for the Mocha framework, such as setting a custom timeout for the tests. The `run` function executes the tests with the specified configuration, allowing for flexible and tailored test runs.

const { run } = require('@wdio/runner');

const config = {
  specs: ['./test/specs/**/*.js'],
  capabilities: [{ browserName: 'chrome' }],
  logLevel: 'debug',
  framework: 'mocha',
  reporters: ['spec'],
  mochaOpts: {
    timeout: 60000,
  },
};

run(config).then(
  (exitCode) => process.exit(exitCode),
  (error) => {
    console.error('Error:', error);
    process.exit(1);
  }
);

Other packages similar to @wdio/runner

Keywords

FAQs

Package last updated on 12 Oct 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc