
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
karma-commonjs-alias
Advanced tools
A Karma plugin. Test CommonJS modules with added alias support
Here is a link to the original repo karma-commonjs . Go there for a full list of features.
Added the ability to alias modules for testing. This is useful for mocking and specifying environment. It works the same way as file aliasing in grunt-browserify. Also can alias directories, below is an example.
Here is an example karma.conf configuration
module.exports = function (config) {
config.set({
...
commonjsPreprocessor: {
alias : {
'./config/dev.js': 'config',
// Core folder alias, can be used as 'core/util/dom' instead of './js/core/util/dom'
'./js/core': 'core'
}
}
...
});
}
In another file, you can specify the following and it will be resolve to ./config/dev.js
require('config');
Just add NPM modules to the files array and they will be available in the tests
module.exports = function (config) {
config.set({
...
files: [
'**/*.js'
'promise-polyfill', // NPM module used in JS files
'observable-lite' // Another NPM module
]
...
});
}
You can create transforms for other file types, for instance handlebars.
module.exports = function (config) {
config.set({
...
commonjsPreprocessor: {
...
transform: {
// Send .hbs extension to karma-commonjs-handlebars node module
'hbs': 'karma-commonjs-handlebars'
}
}
...
});
}
Here is an example of a transform plugin karma-commonjs-handlebars
npm install karma-commonjs-alias
FAQs
A Karma plugin. Test CommonJS modules with added alias support
We found that karma-commonjs-alias demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.