Vite Plugin Nightwatch screenshot

Vite Plugin Nightwatch

Author Avatar Theme by Nightwatchjs
Updated: 10 Jan 2024
16 Stars

Component testing plugin that integrates Vite with Nightwatch.js. Supports Vue and React components.

Categories

Overview

The vite-plugin-nightwatch is an innovative testing plugin that bridges Vite with Nightwatch.js, offering a seamless experience for developers working with Vue and React components. This integration enhances the component testing process by providing a smooth and efficient way to mount and interact with components directly in the Vite development environment. By leveraging this plugin, developers can ensure their UI components are functioning correctly without extensive configuration.

This plugin simplifies the setup for testing by allowing users to define various options directly in their configuration, making it adaptable to different project requirements. With features that cater to both Vue and React, it’s a versatile tool for any modern web development toolkit.

Features

  • Component Type Specification: Easily specify which type of component to test—choose between Vue or React as needed for your project.

  • Custom Test Renderer: Utilize a custom path for a test renderer, giving you the flexibility to modify or extend the default rendering behavior.

  • Mounting Vue Components: Use browser.mountVueComponent(componentPath, [options], [callback]) to dynamically mount Vue components, passing in props and other configurations.

  • Mounting React Components: Similarly, browser.mountReactComponent(componentPath, [props], [callback]) allows React components to be mounted with necessary props for testing.

  • Launch Component Renderer: The browser.launchComponentRenderer() command helps start tests in the browser, making it easy to navigate to your component testing interface.

  • Script Injection: With browser.importScript(scriptPath, [options], [callback]), inject custom scripts into the page allowing for enhanced testing scenarios using ESM format.

  • Dynamic Launch URL: Set a dynamic launch URL during runtime for easy adjustments based on different testing environments, streamlining the testing workflow.

  • Debugging Support: While debugging components can be complex, this plugin provides functionalities to help facilitate easier debugging in Chrome, optimizing the testing process.