Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default (nightwatchPlugin)
✓ import nightwatchPlugin from 'vite-plugin-nightwatch'
✗ import { nightwatchPlugin } from 'vite-plugin-nightwatch'
Default export only; named export not available.
NightwatchPluginConfig
✓ import type { NightwatchPluginConfig } from 'vite-plugin-nightwatch'
Type import for config options.
browser.mountVueComponent
✓ browser.mountVueComponent('/src/components/Form.vue', { props: { ... } })
✗ browser.mountVueComponent({componentPath: '...'})
Method on Nightwatch browser object, not a direct import.
Setup Vite config with nightwatch plugin and write a basic component test.
// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import nightwatchPlugin from 'vite-plugin-nightwatch';
export default defineConfig({
plugins: [
vue(),
nightwatchPlugin({
componentType: 'vue'
})
]
});
// nightwatch.conf.js
module.exports = {
src_folders: ['tests'],
page_objects_path: [],
custom_commands_path: [],
custom_assertions_path: [],
plugins: ['vite-plugin-nightwatch'],
vite_dev_server: {
start_vite: true,
port: 5173
},
launchUrl: 'http://localhost:5173'
};
// tests/example.spec.js
module.exports = {
'test vue component': function (browser) {
browser
.launchComponentRenderer()
.importScript('/src/components/Form.vue')
.waitForElementVisible('.form')
.assert.textContains('.form h1', 'Hello')
.end();
}
};
Errors
Common errors & fixes
Error: Cannot find module 'vite-plugin-nightwatch'
Missing dependency installation
fixRun: npm install vite-plugin-nightwatch --save-dev
TypeError: browser.mountVueComponent is not a function
Missing Nightwatch plugin registration
fixAdd 'vite-plugin-nightwatch' to plugins array in nightwatch.conf.js
Error: launch_url is not defined
Missing launchUrl or baseUrl in config
fixSet launchUrl: 'http://localhost:5173' in nightwatch.conf.js
Audit
Dependencies
nightwatchrequiredPeer dependency for Nightwatch API commands