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

pmcelhaney / counterfact / 6030589989

30 Aug 2023 10:12PM UTC coverage: 83.297% (-0.3%) from 83.567%
6030589989

push

github

web-flow
Merge pull request #540 from pmcelhaney/ci-fixes

390 of 424 branches covered (0.0%)

Branch coverage included in aggregate %.

1924 of 2354 relevant lines covered (81.73%)

9.6 hits per line

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

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

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

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

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

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

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

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

1✔
39
  write(script) {
1✔
40
    if (script.path === "paths/$.context.ts") {
1!
41
      return "new Context()";
×
42
    }
×
43

1✔
44
    script.repository.get(script.path).exportDefault(this);
1✔
45

1✔
46
    return { raw: 'export { default } from "../$.context.mjs"' };
1✔
47
  }
1✔
48

1✔
49
  modulePath() {
1✔
50
    return nodePath
×
51
      .join("paths", nodePath.dirname(this.pathString()), "$.context.ts")
×
52
      .replaceAll("\\", "/");
×
53
  }
×
54
}
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

© 2026 Coveralls, Inc