skellock / typescript-with-electron-react-kit

Don't just start your Electron app... TWERKit.
https://skellock.github.io/typescript-with-electron-react-kit
MIT License
145 stars 23 forks source link

Jest fails when running on Windows due to path separator difference #121

Closed skairunner closed 6 years ago

skairunner commented 6 years ago
FAIL src\main-window\load-url.test.ts
  ● loads from electron

    expect(jest.fn()).toBeCalledWith(expected)

    Expected mock function to have been called with:
      "file:///a/out/index.html" as argument 1, but it was called with "file:///a\\out\\index.html".

      10 |   const loadStub = jest.fn()
      11 |   loadURL({ loadURL: loadStub } as any, "a", false)
    > 12 |   expect(loadStub).toBeCalledWith("file:///a/out/index.html")
      13 | })
      14 |

      at Object.<anonymous>.test (src/main-window/load-url.test.ts:12:20)

This is the error message. The difference between /s and \s is mostly an OS choice thing (and I cannot fathom why Windows ever decided to go with \s) but it does cause an error.

skellock commented 6 years ago

Thanks for the heads up.