Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

istanbul.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict'
  2. function InstrumenterIstanbul (options) {
  3. const { createInstrumenter } = require('istanbul-lib-instrument')
  4. const convertSourceMap = require('convert-source-map')
  5. const instrumenter = createInstrumenter({
  6. autoWrap: true,
  7. coverageVariable: '__coverage__',
  8. embedSource: true,
  9. compact: options.compact,
  10. preserveComments: options.preserveComments,
  11. produceSourceMap: options.produceSourceMap,
  12. ignoreClassMethods: options.ignoreClassMethods,
  13. esModules: options.esModules,
  14. parserPlugins: options.parserPlugins
  15. })
  16. return {
  17. instrumentSync (code, filename, { sourceMap, registerMap }) {
  18. var instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
  19. if (instrumented !== code) {
  20. registerMap()
  21. }
  22. // the instrumenter can optionally produce source maps,
  23. // this is useful for features like remapping stack-traces.
  24. if (options.produceSourceMap) {
  25. var lastSourceMap = instrumenter.lastSourceMap()
  26. /* istanbul ignore else */
  27. if (lastSourceMap) {
  28. instrumented += '\n' + convertSourceMap.fromObject(lastSourceMap).toComment()
  29. }
  30. }
  31. return instrumented
  32. },
  33. lastFileCoverage () {
  34. return instrumenter.lastFileCoverage()
  35. }
  36. }
  37. }
  38. module.exports = InstrumenterIstanbul