![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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
The npm package karma-commonjs-alias receives a total of 9 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.