
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
mocha-loader
Advanced tools
Allows Mocha tests to be loaded and run via webpack.
To begin, you'll need to install mocha-loader
and mocha
:
npm install --save-dev mocha-loader mocha
Then add the plugin to your webpack
config. For example:
file.js
import test from './test.js';
webpack.config.js
module.exports = {
entry: './entry.js',
output: {
path: __dirname,
filename: 'bundle.js',
},
module: {
rules: [
{
test: /test\.js$/,
use: 'mocha-loader',
exclude: /node_modules/,
},
],
},
};
And run webpack
via your preferred method.
Alternative usage (without configuration):
import test from 'mocha-loader!./test.js';
No options for loader.
file.js
module.exports = true;
test.js
describe('Test', () => {
it('should succeed', (done) => {
setTimeout(done, 1000);
});
it('should fail', () => {
setTimeout(() => {
throw new Error('Failed');
}, 1000);
});
it('should randomly fail', () => {
if (require('./module')) {
throw new Error('Randomly failed');
}
});
});
Please take a moment to read our contributing guidelines if you haven't yet done so.
5.1.5 (2020-10-15)
css-loader
FAQs
Mocha loader for webpack
The npm package mocha-loader receives a total of 13,102 weekly downloads. As such, mocha-loader popularity was classified as popular.
We found that mocha-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.