Skip to content

Commit

Permalink
fix(checks): checks causes console to hang (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb authored Nov 20, 2023
1 parent ebfdf4f commit 8a09861
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
16 changes: 0 additions & 16 deletions checks/bug.main.w

This file was deleted.

1 change: 1 addition & 0 deletions checks/check.w
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub class Check impl ICheck {
}

this.results.store(result);

return Json.stringify(result);
};

Expand Down
3 changes: 0 additions & 3 deletions checks/failing.main.w

This file was deleted.

14 changes: 12 additions & 2 deletions checks/results.w
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ pub struct CheckResult {
/** Centralized storage for check results */
pub class Results {
pub static of(scope: std.IResource): Results {
let root = std.Node.of(scope).root;
let id = "cloud.CheckResults";
let var root = std.Node.of(scope).root;

// special case where the root is an app with a test runner (which means we are running inside a test context)
// in this case our app is actually the child called "Default". yes this is horribly hacky.
// help! https://github.com/winglang/wing/issues/513
if root.node.tryFindChild("cloud.TestRunner") != nil {
if let defaultChild = root.node.defaultChild {
root = defaultChild;
}
}

let id = "checks.Results";
let exists: Results? = unsafeCast(root.node.tryFindChild(id));
let rootAsResource: Results = unsafeCast(root);
return exists ?? new Results() as id in rootAsResource;
Expand Down

0 comments on commit 8a09861

Please sign in to comment.