Skip to content

Commit

Permalink
Add logging to help diagnose windows test run failure
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissimon-au committed Nov 27, 2023
1 parent 7927d21 commit c56bc52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/vscode/contextive/test/helpers/Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ open Node.Api
open Fable.Core
open Fable.Mocha

let util: obj = JsInterop.importAll "node:util"

[<Emit("util.inspect($0, { showHidden: true, depth: null, getters: true })")>]
let inspect (_: obj) = jsNative

let logInspect o = JS.console.log (inspect (o))

let waitForTimeout timeoutMs (condition: unit -> JS.Promise<bool>) =
promise {
let endTime = System.DateTime.Now.AddMilliseconds(timeoutMs)
Expand All @@ -16,7 +23,7 @@ let waitForTimeout timeoutMs (condition: unit -> JS.Promise<bool>) =
while (not conditionResult && System.DateTime.Now < endTime) do
let! result = condition ()
conditionResult <- result
do! Promise.sleep 50
do! Promise.sleep 100

if (not conditionResult) then
failwith $"Condition still untrue after {timeoutMs}ms"
Expand All @@ -33,6 +40,11 @@ let findUriInVisibleEditors (path: Uri) =
let documentIsOpen docUri () =
promise {
let editor = findUriInVisibleEditors (docUri)
printfn "docUri is: %s" (docUri.toString ())
printfn "editors are:"
logInspect window.visibleTextEditors
printfn "editor is:"
logInspect editor
return editor <> null
}

Expand Down Expand Up @@ -102,14 +114,6 @@ let deleteFile fullPath =
let deleteConfiguredDefinitionsFile () =
promise { do! deleteFile <| getFullPathFromConfig () }

let util: obj = JsInterop.importAll "node:util"

[<Emit("util.inspect($0, { showHidden: true, depth: null, getters: true })")>]
let inspect (_: obj) = jsNative

let logInspect o = JS.console.log (inspect (o))


[<Emit("afterEach($0, $1)")>]
let afterEach (name: string, callback: unit -> JS.Promise<unit>) : unit = jsNative

Expand Down
2 changes: 1 addition & 1 deletion src/vscode/contextive/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Mocha = require('mocha');
const glob = require('glob');

function getMochaOpts() {
const defaultOpts = {timeout: 25000};
const defaultOpts = {timeout: 60000};
if (process.env.MOCHA_FGREP) {
return {
fgrep: process.env.MOCHA_FGREP,
Expand Down

0 comments on commit c56bc52

Please sign in to comment.