Closed TheEdward162 closed 1 year ago
Before diving to implementation, I want quickly share opinion:
super.json
, but I assume to the interpreters perform is passed already merged value of input and integration parameters with defaults from super.json
. I would take advantage of control under Comlinks in station and before releasing, test it against to see if it even happened.
Good news: Tests now compile and all map interpreter tests pass, no less tests pass than in base. Verified by quickly cooking up a differ[0] and checking
jest --json --outputFile tests.json
on the base branch vs. this branch (python3 differ.py tests1.json tests2.json
).This contains two BREAKING CHANGEs:
string | string[]
, instead telling the user to stringify them themselves before useinput
norparameter
in interpreter if they are passed in asundefined
ornull
(although with null it is an invalid use of the perform API).input
object when there is no inputIt also fixes query parameter handling which was apparently broken across 3 places, so now we can pass string arrays to query as well. yay.
[0] Differ:
```python import json import sys with open(sys.argv[1], "r") as file: left_json = json.load(file) with open(sys.argv[2], "r") as file: right_json = json.load(file) left = left_json["testResults"] right = right_json["testResults"] def find_suite(results, name): for (i, suite) in enumerate(results): if suite["name"] == name: return i return None def find_test(tests, name): for (i, tests) in enumerate(tests): if tests["fullName"] == name: return i return None def reverse_side(side): return "right" if side == "left" else "left" def diff_tests(left, right, out, side = "left"): left_i = 0 while True: if left_i >= len(left): break left_test = left[left_i] right_i = find_test(right, left_test["fullName"]) if right_i is None: out.append( (side, "test", left_test["fullName"], left_test["status"]) ) del left[left_i] continue right_test = right[right_i] if left_test["status"] != right_test["status"]: if left_test["status"] != "passed": out.append( (side, "test", left_test["fullName"], left_test["status"]) ) else: out.append( (reverse_side(side), "test", right_test["fullName"], right_test["status"]) ) del left[left_i] del right[right_i] if len(right) > 0: diff_tests(right, left, out, side = reverse_side(side)) def diff_results(left, right, out, side = "left"): left_i = 0 while True: if left_i >= len(left): break left_suite = left[left_i] right_i = find_suite(right, left_suite["name"]) if right_i is None: out.append( (side, "suite", left_suite["name"], left_suite["status"]) ) del left[left_i] continue right_suite = right[right_i] if left_suite["status"] != right_suite["status"]: left_tests = left_suite["assertionResults"] right_tests = right_suite["assertionResults"] diff_tests(left_tests, right_tests, out) del left[left_i] del right[right_i] if len(right) > 0: diff_results(right, left, out, side = reverse_side(side)) out = [] diff_results(left, right, out) for diff in out: print(diff) ```