• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jsonicjs / multisource / 11465356215

22 Oct 2024 05:25PM UTC coverage: 92.578% (+8.3%) from 84.328%
11465356215

push

github

rjrodger
fix-build

93 of 112 branches covered (83.04%)

Branch coverage included in aggregate %.

855 of 912 relevant lines covered (93.75%)

13.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/processor/js.ts
1
/* Copyright (c) 2021 Richard Rodger, MIT License */
1✔
2

1✔
3

1✔
4
import {
1✔
5
  Processor,
1✔
6
  Resolution,
1✔
7
} from '../multisource'
1✔
8

1✔
9

1✔
10
function makeJavaScriptProcessor(opts?: {
1✔
11
  // evalOnly?: boolean
1✔
12
}): Processor {
1✔
13

1✔
14
  const JavaScriptProcessor = (
1✔
15
    res: Resolution,
3✔
16
  ) => {
3✔
17
    res.val = evaluate(res, opts)
3✔
18
  }
3✔
19

1✔
20
  JavaScriptProcessor.opts = opts
1✔
21

1✔
22
  return JavaScriptProcessor
1✔
23
}
1✔
24

1✔
25
// TODO: too simplistic - handle more module cases
1✔
26
function evaluate(res: Resolution, _opts?: any) {
3✔
27
  let out = undefined
3✔
28
  // if (true !== opts?.evalOnly && undefined !== typeof (require)) {
3✔
29
  out = require((res.full as string))
3✔
30
  out = null != out.default ? out.default : out
3!
31
  // }
3✔
32
  // else {
3✔
33
  //   let exports = null
3✔
34
  //   let module = { exports }
3✔
35
  //   eval((res.src as string))
3✔
36
  //   out = module.exports
3✔
37
  // }
3✔
38
  return out
3✔
39
}
3✔
40

1✔
41
export {
×
42
  makeJavaScriptProcessor
×
43
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc