
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@nightwatch/svelte
Advanced tools
Nightwatch plugin which adds support for Svelte component testing using the Vite dev server. Requires Nightwatch 2.0+
Official Nightwatch plugin which adds component testing support for Svelte apps. It uses the Vite dev server under the hood and vite-plugin-nightwatch. Requires Nightwatch 3.0.1+
npm install @nightwatch/svelte
Update your Nightwatch configuration and add the plugin to the list:
module.exports = {
plugins: ['@nightwatch/svelte']
// other nightwatch settings...
}
If you already have a Vite project, then the @nightwatch/svelte
plugin will try to use the existing vite.config.js
or vite.config.ts
, if either one is found.
Check the vite-plugin-nightwatch project for more configuration options.
Update the vite.config.js
and add the vite-plugin-nightwatch
plugin:
// vite.config.js
import nightwatchPlugin from 'vite-plugin-nightwatch'
export default {
plugins: [
// ... other plugins, such as svelte()
nightwatchPlugin()
]
})
We’ve designed the @nightwatch/svelte
plugin to work with sensible configuration defaults, but in some more advanced scenarios you may need to change some of the config options.
By default, Nightwatch will attempt to start the Vite dev server automatically. You can disable that by adding the below in your nightwatch.conf.js
file, under the vite_dev_server
dictionary.
This is common to other component testing plugins that are based on Vite, such as the @nightwatch/react
plugin.
// nightwatch.conf.js
module.exports = {
plugins: ['@nightwatch/svelte'],
vite_dev_server: {
start_vite: true,
port: 5173
}
}
The plugin accepts a few config options which can be set when working with an existing vite.config.js
file in the project.
renderPage
Specify the path to a custom test renderer to be used. A default renderer is included in the package, but this option can overwrite that value.
// vite.config.js
export default {
plugins: [
// ... other plugins, such as svelte() or vue()
nightwatchPlugin({
renderPage: './src/test_renderer.html'
})
]
}
This plugin includes a few Nightwatch commands which can be used while writing Svelte component tests.
componentPath
, [options]
, [callback]
):Parameters:
componentPath
– location of the component file (.jsx
) to be mountedoptions
– this can include:
callback
– an optional callback function which will be called with the component elementconst component = await browser.mountComponent('/src/components/Form.svelte')
const component = await browser.mountComponent('/src/components/Welcome.svelte', {
props: {
username: 'John Doe'
}
})
const component = await browser.mountComponent('/src/components/Form.svelte', {
mocks: {
'/api/get-user': {
type: 'fetch',
body: {
data: {
"firstName": "Jimmy",
"lastName": "Hendrix"
}
}
}
}
})
Debugging component tests in Nightwatch isn't as straightforward as debugging a regular Node.js application or service, since Nightwatch needs to inject the code to render to component into the browser.
However, since Nightwatch v2.4 we provide several ways to inspect and debug the mounted component using the browser devtools console. Refer to the guide page on our docs website for more details: https://nightwatchjs.org/guide/component-testing/debugging.html
npx nightwatch test/src/userInfoTest.js --devtools --debug
Tests for this project are written in Nightwatch, so you can inspect them as examples, located in the [tests/src] folder.
Run them with::
npm test
MIT
FAQs
Nightwatch plugin which adds support for Svelte component testing using the Vite dev server. Requires Nightwatch 2.0+
We found that @nightwatch/svelte demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.