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

pmcelhaney / counterfact / 5942933897

22 Aug 2023 06:59PM UTC coverage: 83.567% (-3.8%) from 87.388%
5942933897

push

github

web-flow
Merge pull request #517 from pmcelhaney/windows-support

disable the end-to-end test because it won't work on Windows

389 of 423 branches covered (91.96%)

Branch coverage included in aggregate %.

1818 of 2218 relevant lines covered (81.97%)

9.64 hits per line

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

54.84
/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
    const parentPath = nodePath.normalize(
1✔
45
      nodePath.join(script.path, "../../$.context.ts").replaceAll("\\", "/")
1✔
46
    );
1✔
47

1✔
48
    script.repository.get(parentPath).exportDefault(this);
1✔
49

1✔
50
    return { raw: 'export { default } from "../$.context.js"' };
1✔
51
  }
1✔
52

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