S2 EsLint implementation
All checks were successful
Build, test and publish / verify (push) Successful in 1m40s
All checks were successful
Build, test and publish / verify (push) Successful in 1m40s
This commit is contained in:
@@ -102,6 +102,21 @@ class CiTests {
|
||||
equal(0L,f.calls("build")); equal(0L,f.calls("push"));
|
||||
}
|
||||
});
|
||||
test("Frontend lint runs after install and blocks tests and build on failure", () -> {
|
||||
try (Fixture f = new Fixture()) {
|
||||
f.fake.lintFailure = true;
|
||||
try { f.pipeline.verifyFrontend(); throw new AssertionError("Expected failure"); }
|
||||
catch (Commands.Failure error) { equal(1,error.exitCode); }
|
||||
equal(List.of(List.of("npm", "ci"), List.of("npm", "run", "lint")), f.fake.calls);
|
||||
}
|
||||
});
|
||||
test("Frontend verification checks before testing and building", () -> {
|
||||
try (Fixture f = new Fixture()) {
|
||||
f.pipeline.verifyFrontend();
|
||||
equal(List.of("ci", "run lint", "test -- --reporters=default --reporters=junit --output-file=unit-results/junit.xml", "run build"),
|
||||
f.fake.calls.stream().map(a -> String.join(" ", a.subList(1,a.size()))).toList());
|
||||
}
|
||||
});
|
||||
test("Process execution enforces its deadline", () -> {
|
||||
Path dir = Files.createTempDirectory("ci-process-test-");
|
||||
try {
|
||||
@@ -135,13 +150,14 @@ class CiTests {
|
||||
final List<List<String>> calls = new ArrayList<>();
|
||||
final Map<String,String> images = new HashMap<>(), tags = new HashMap<>();
|
||||
String head = SHA, pushFailure = "", pullFailure = "";
|
||||
boolean manifestError, mavenFailure;
|
||||
boolean manifestError, mavenFailure, lintFailure;
|
||||
boolean dockerAvailable = true;
|
||||
FakeCommands() { super(Duration.ofMinutes(1)); }
|
||||
@Override Result execute(List<String> args, Path cwd, Map<String,String> env, String input, boolean echo) {
|
||||
calls.add(List.copyOf(args));
|
||||
if (args.getFirst().equals("git")) return new Result(0,SHA);
|
||||
if (args.getFirst().equals("mvn") && mavenFailure) return new Result(42,"deliberate failure");
|
||||
if (args.equals(List.of("npm", "run", "lint")) && lintFailure) return new Result(1,"deliberate lint failure");
|
||||
if (!args.getFirst().equals("docker")) return new Result(0,"");
|
||||
String command = args.get(1), ref = args.getLast();
|
||||
if (command.equals("info")) return new Result(dockerAvailable ? 0 : 1,args.contains("{{.Architecture}}") ? "amd64" : "linux");
|
||||
|
||||
Reference in New Issue
Block a user