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

nodeplusplus / xregex-template / 91e33cb3-6927-4a5a-b950-8a65e8171027

pending completion
91e33cb3-6927-4a5a-b950-8a65e8171027

Pull #16

circleci

Unknown Committer
Unknown Commit Message
Pull Request #16: Bump json5 from 2.1.3 to 2.2.3

48 of 48 branches covered (100.0%)

Branch coverage included in aggregate %.

64 of 64 relevant lines covered (100.0%)

7.11 hits per line

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

100.0
/src/Validator/Base.validator.ts
1
import _ from "lodash";
2✔
2
import Joi from "joi";
3

4
import {
5
  GenericObject,
6
  IXTemplateValidator,
7
  IXTemplateValidatorError,
8
} from "../types";
9

10
export abstract class BaseValidator implements IXTemplateValidator {
2✔
11
  public get ids() {
12
    const ids = [this.getId()];
2✔
13
    if (this.validator) ids.unshift(...this.validator.ids);
2✔
14
    return ids;
2✔
15
  }
16

17
  protected validator?: IXTemplateValidator;
18
  constructor(validator?: IXTemplateValidator) {
19
    this.validator = validator;
6✔
20
  }
21

22
  public validate(template: any) {
23
    const prevErrors = this.validator ? this.validator.validate(template) : [];
2✔
24

25
    const validators = this.getValidators();
2✔
26
    const { error } = validators.validate(template, { abortEarly: false });
2✔
27
    const errors = error
2✔
28
      ? error.details.map((error) => _.pick(error, ["type", "path", "message"]))
1✔
29
      : [];
30

31
    return _.uniqBy([...prevErrors, ...errors], (e) =>
2✔
32
      e.path.join(".")
1✔
33
    ) as IXTemplateValidatorError[];
34
  }
35

36
  public getComponents(template: any): GenericObject {
37
    return this.validator ? this.validator.getComponents(template) : {};
2✔
38
  }
39

40
  protected abstract getId(): string;
41
  protected abstract getValidators(): Joi.ObjectSchema;
42
}
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