
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@wdio/mocha-framework
Advanced tools
A WebdriverIO plugin. Adapter for Mocha testing framework.
The easiest way is to keep @wdio/mocha-framework
as a devDependency in your package.json
, via:
npm install @wdio/mocha-framework --save-dev
Instructions on how to install WebdriverIO
can be found here.
Following code shows the default wdio test runner configuration...
// wdio.conf.js
module.exports = {
// ...
framework: 'mocha',
mochaOpts: {
ui: 'bdd'
}
// ...
};
Note that interfaces supported are bdd
, tdd
and qunit
. If you want to provide a custom interface, it should expose methods compatible with them and be named ending with -bdd
, -tdd
or -qunit
accordingly.
mochaOpts
OptionsOptions will be passed to the Mocha instance. See the list of supported Mocha options here.
mochaOpts.require (string|string[])
The require
option is useful when you want to add or extend some basic functionality.
For example, let's try to create an anonymous describe
:
wdio.conf.js
{
suites: {
login: ['tests/login/*.js']
},
mochaOpts: {
require: './hooks/mocha.js'
}
}
./hooks/mocha.js
import path from 'path';
let { context, file, mocha, options } = module.parent.context;
let { describe } = context;
context.describe = function (name, callback) {
if (callback) {
return describe(...arguments);
} else {
callback = name;
name = path.basename(file, '.js');
return describe(name, callback);
}
}
./tests/TEST-XXX.js
describe(() => {
it('Login form', function () => {
this.skip();
});
});
Output
TEST-XXX
✓ Login form
mochaOpts.compilers (string[])
Use the given module(s) to compile files. Compilers will be included before requires.
CoffeeScript and similar transpilers may be used by mapping the file extensions and the module name.
{
mochaOpts: {
compilers: ['coffee:foo', './bar.js']
}
}
For more information on WebdriverIO see the homepage.
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It works out of the box with minimal configuration and provides a rich API for writing tests. Compared to @wdio/mocha-framework, Jest is more opinionated and comes with built-in mocking, assertion, and test coverage tools.
Cypress is a next-generation front-end testing tool built for the modern web. It provides a fast, easy, and reliable testing for anything that runs in a browser. Unlike @wdio/mocha-framework, Cypress is an all-in-one testing framework that includes everything you need to write, run, and debug tests.
Nightwatch.js is an integrated, easy-to-use End-to-End testing solution for browser-based apps and websites, written in Node.js. It uses the W3C WebDriver API to perform commands and assertions on DOM elements. Compared to @wdio/mocha-framework, Nightwatch provides a more integrated solution with built-in test runner and assertion library.
FAQs
A WebdriverIO plugin. Adapter for Mocha testing framework.
The npm package @wdio/mocha-framework receives a total of 469,191 weekly downloads. As such, @wdio/mocha-framework popularity was classified as popular.
We found that @wdio/mocha-framework demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.