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

source-academy / js-slang / 15237418122

25 May 2025 11:31AM UTC coverage: 77.048% (-3.5%) from 80.538%
15237418122

push

github

web-flow
Rewrite: Stepper (#1742)

3433 of 4826 branches covered (71.14%)

Branch coverage included in aggregate %.

1032 of 1260 new or added lines in 27 files covered. (81.9%)

440 existing lines in 29 files now uncovered.

10099 of 12737 relevant lines covered (79.29%)

142411.96 hits per line

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

93.33
/src/runner/utils.ts
1
import type { Program } from 'estree'
2

3
import type { IOptions, Result } from '..'
4
import { areBreakpointsSet } from '../stdlib/inspector'
59✔
5
import type { Context, RecursivePartial, Variant } from '../types'
6
import { simple } from '../utils/walkers'
59✔
7

8
// Context Utils
9

10
/**
11
 * Small function to determine the variant to be used
12
 * by a program, as both context and options can have
13
 * a variant. The variant provided in options will
14
 * have precedence over the variant provided in context.
15
 *
16
 * @param context The context of the program.
17
 * @param options Options to be used when
18
 *                running the program.
19
 *
20
 * @returns The variant that the program is to be run in
21
 */
22
export function determineVariant(context: Context, options: RecursivePartial<IOptions>): Variant {
59✔
23
  if (options.variant) {
2,959!
UNCOV
24
    return options.variant
×
25
  } else {
26
    return context.variant
2,959✔
27
  }
28
}
29

30
export function determineExecutionMethod(
59✔
31
  theOptions: IOptions,
32
  context: Context,
33
  program: Program,
34
  verboseErrors: boolean
35
): void {
36
  if (theOptions.executionMethod !== 'auto') {
1,813✔
37
    context.executionMethod = theOptions.executionMethod
716✔
38
    return
716✔
39
  }
40

41
  if (context.executionMethod !== 'auto') {
1,097✔
42
    return
467✔
43
  }
44

45
  let isNativeRunnable
46
  if (verboseErrors || areBreakpointsSet()) {
630✔
47
    isNativeRunnable = false
27✔
48
  } else {
49
    let hasDebuggerStatement = false
603✔
50
    simple(program, {
603✔
51
      DebuggerStatement() {
52
        hasDebuggerStatement = true
6✔
53
      }
54
    })
55
    isNativeRunnable = !hasDebuggerStatement
603✔
56
  }
57

58
  context.executionMethod = isNativeRunnable ? 'native' : 'cse-machine'
630✔
59
}
60

61
// AST Utils
62

63
export const resolvedErrorPromise = Promise.resolve({ status: 'error' } as Result)
59✔
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