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

pmcelhaney / counterfact / 6512171351

13 Oct 2023 07:09PM CUT coverage: 86.447% (-1.4%) from 87.815%
6512171351

Pull #606

github

pmcelhaney
quick and dirty migration script
Pull Request #606: fix root context not shared

747 of 823 branches covered (0.0%)

Branch coverage included in aggregate %.

99 of 99 new or added lines in 6 files covered. (100.0%)

2455 of 2881 relevant lines covered (85.21%)

39.72 hits per line

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

82.14
/src/typescript-generator/context-coder.js
1
import nodePath from "node:path";
2✔
2

2✔
3
import { Coder } from "./coder.js";
2✔
4

2✔
5
export class ContextCoder extends Coder {
2✔
6
  pathString() {
2✔
7
    return this.requirement.url
×
8
      .split("/")
×
9
      .at(-2)
×
10
      .replaceAll("~1", "/")
×
11
      .replaceAll("~0", "~");
×
12
  }
×
13

2✔
14
  get id() {
2✔
15
    return "ContextCoder";
4✔
16
  }
4✔
17

2✔
18
  names() {
2✔
19
    return super.names("Context");
4✔
20
  }
4✔
21

2✔
22
  beforeExport(path) {
2✔
23
    return `/**
4✔
24
* This is the default context for Counterfact.
4✔
25
* Change the code to suit your needs.
4✔
26
*/
4✔
27
class Context {
4✔
28
  // delete this line to make the class type safe
4✔
29
  [key: string]: any; 
4✔
30

4✔
31
  // A helper when you accessing the context object via the REPL. You can delete it if you like.
4✔
32
  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
4✔
33
    return inspect(this, { ...options, customInspect: false }) + "\\n\\n ^ This is the default context object. You can edit its definition at ${path}";
4✔
34
  }
4✔
35
}
4✔
36
`;
4✔
37
  }
4✔
38

2✔
39
  write() {
2✔
40
    return "new Context()";
4✔
41
  }
4✔
42

2✔
43
  modulePath() {
2✔
44
    return nodePath
×
45
      .join("paths", nodePath.dirname(this.pathString()), "$.context.ts")
×
46
      .replaceAll("\\", "/");
×
47
  }
×
48
}
2✔
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