Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
karma-commonjs-alias
Advanced tools
Readme
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
The npm package karma-commonjs-alias receives a total of 25 weekly downloads. As such, karma-commonjs-alias popularity was classified as not popular.
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.