Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
aura-require
Advanced tools
Import Aura singletons and libraries as if they were CommonJS modules
Facilitates unit testing of Aura singletons and libraries by allowing us to import them as if they were CommonJS modules. We can also pass a second argument that will be used to stub out any global variable references in the code being tested.
When testing without coverage, the code is parsed and executed in a JavaScript
VM. When testing with coverage, we write the modified source to disk and then
require()
it. This is because most coverage tools hook into the require()
in order to instrument the code before it executes.
const optionalGlobalStubs = {
'$A': {
get: () => {},
set: () => {}
},
document: {
querySelector: () => {}
}
};
const libSetup = require('aura-require')(pathToLib, optionalGlobalStubs);
// <aura:include name="lib" imports="dependencyA, dependencyB"/>
const dependencyA = { foo: () => {} };
const dependencyB = { bar: () => {} };
const lib = libSetup(dependencyA, dependencyB);
npm install aura-require
Declare the following environment variable to enable coverage:
COVERAGE_ENABLED=true
Declare the following environment variable to specify the directory in which
the generated build files should go: BUILD_COVERAGE_DIR=build/coverage/
If not specified, the default directory is build/coverage/
{
"script": {
"test:coverage": "COVERAGE_ENABLED=true COVERAGE_BUILD_DIR=build/coverage/ tap --coverage src/test/unit/**/*.js"
},
}
FAQs
Import Aura singletons and libraries as if they were CommonJS modules
We found that aura-require 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.