Skip to content

Commit

Permalink
Fix headless test runner on macOS High Sierra
Browse files Browse the repository at this point in the history
  • Loading branch information
LegNeato committed Feb 26, 2019
1 parent 74a39ce commit eb74685
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,21 @@ impl Client {
Driver::Safari(_) => {
#[derive(Deserialize)]
struct Response {
// returned by `--legacy`
// returned by `--legacy` or by default on High Sierra and lower.
#[serde(rename = "sessionId")]
session_id: Option<String>,
// returned by the now-default `--w3c` mode
#[serde(flatten)]
#[allow(dead_code)]
value: Option<Value>,
}
#[derive(Deserialize)]
struct Value {
// This needs to be optional because both `--legacy` and High Sierra do not
// include a session id in the value entry.
#[serde(rename = "sessionId")]
session_id: String,
#[allow(dead_code)]
session_id: Option<String>,
}
let request = json!({
// this is needed for the now `--legacy` mode
Expand All @@ -303,7 +308,7 @@ impl Client {
}
});
let x: Response = self.post("/session", &request)?;
Ok(x.session_id.or(x.value.map(|v| v.session_id)).unwrap())
Ok(x.session_id.unwrap())
}
Driver::Chrome(_) => {
#[derive(Deserialize)]
Expand Down

0 comments on commit eb74685

Please sign in to comment.