Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ciara

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ciara - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

43

index.js

@@ -8,4 +8,3 @@ var vm = require('vm')

var reporter = new istanbul.Reporter()
var sandboxes = []
var config = { report: true }
var coverageObjects = []

@@ -15,7 +14,7 @@ process.on('exit', function onExit() {

if (config.report) {
sandboxes.map(function mapSandbox(sandbox) {
collector.add(sandbox.__coverage__)
})
coverageObjects.map(function mapSandbox(coverageObject) {
collector.add(coverageObject)
})
if (coverageObjects.length > 0) {
reporter.addAll([ 'lcov', 'clover' ])

@@ -27,26 +26,20 @@ reporter.write(collector, sync, function anonymous() {})

module.exports = {
getScript: function getScript(filename) {
var code = fs.readFileSync(filename).toString()
var instrumentedCode = instrumenter.instrumentSync(code, filename)
var script = new vm.Script(instrumentedCode, { filename: filename })
script.isInstrumented = true
return script
},
runInContext: function runInContext(filename, context, fn) {
var code = fs.readFileSync(filename).toString()
var instrumentedCode = config.report ?
instrumenter.instrumentSync(code, filename) : code
var script = this.getScript(filename)
return this.runScriptInContext(script, context, fn)
},
runScriptInContext: function runScriptInContext(script, context, fn) {
var sandbox = vm.createContext(context)
var script = new vm.Script(instrumentedCode, { filename: filename })
script.runInContext(sandbox)
sandboxes.push(sandbox)
if (fn) {
fn(sandbox)
}
if (script.isInstrumented) coverageObjects.push(sandbox.__coverage__)
if (fn) fn(sandbox)
return sandbox
},
config: function configFn(additionalOptions) {
var option
if (additionalOptions) {
for (option in additionalOptions) {
if (additionalOptions.hasOwnProperty(option)) {
config[option] = additionalOptions[option]
}
}
}
},
}

@@ -44,3 +44,3 @@ {

],
"version": "1.0.0"
"version": "1.1.0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc