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

Kikobeats / whoops / 6078853186

05 Sep 2023 12:47AM CUT coverage: 96.33%. First build
6078853186

Pull #43

github

web-flow
Merge a5aaa20fb into 5c23c76cd
Pull Request #43: Bump actions/checkout from 3 to 4

23 of 26 branches covered (0.0%)

105 of 109 relevant lines covered (96.33%)

6.87 hits per line

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

88.24
/src/create-error.js
1
'use strict'
1✔
2

1✔
3
const { inherits } = require('./helpers')
1✔
4
const mimicFn = require('mimic-fn')
1✔
5

1✔
6
const REGEX_CLASS_NAME = /[^0-9a-zA-Z_$]/
1✔
7

1✔
8
function createError (className) {
13✔
9
  if (typeof className !== 'string') {
13!
10
    throw new TypeError('Expected className to be a string')
×
11
  }
×
12

13✔
13
  if (REGEX_CLASS_NAME.test(className)) {
13!
14
    throw new Error('className contains invalid characters')
×
15
  }
×
16

13✔
17
  function ErrorClass () {
13✔
18
    Object.defineProperty(this, 'name', {
11✔
19
      configurable: true,
11✔
20
      value: className,
11✔
21
      writable: true
11✔
22
    })
11✔
23

11✔
24
    if ('captureStackTrace' in Error) {
11✔
25
      Error.captureStackTrace(this, this.constructor)
11✔
26
    }
11✔
27
  }
11✔
28

13✔
29
  inherits(ErrorClass, Error)
13✔
30
  mimicFn(ErrorClass, Error)
13✔
31
  return ErrorClass
13✔
32
}
13✔
33

1✔
34
module.exports = createError
1✔
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

© 2025 Coveralls, Inc