Purescript Browser Tests

I’m trying to set up browser PureScript tests. I found that this can be done with Mocha (GitHub - purescript-spec/purescript-spec-mocha: A test runner and reporter for purescript-spec that integrates with Mocha), but I’m having trouble. Is there a minimally complete example of running PureScript tests in the browser I can reference?

Thanks!

What trouble are you experiencing?

I also tried using spec-mocha to write some Mocha tests. I found that it didn’t doesn’t work because spec never uses Mocha’s primitives other than the it and describe. So, using hooks like beforeEach, etc., aren’t called the same way in spec-mocha as they would be if you called them directly.

The trouble I’m having is that the documentation around browser testing is too fragmented. Purescript-spec (purescript-spec. github. io/purescript-spec/#browser-testing) notes that tests can be run in the browser and points to purescript-spec-mocha. That, in turn, has code snippets and references mocha browser test code snippets which is deep into the mocha documentation and references prior testing code. I can’t find anything that ties all together in a single test suite example for testing PureScript in the browser.

Ah… gotcha. I don’t think there’s much docs in browser testing in general.

Are you aiming to do unit tests in the browser (as mocha would make sense for that) or something along the lines of Cypress for integration testing or Storybook for component testing / design?

Are you aiming to do unit tests in the browser (as mocha would make sense for that) or something along the lines of Cypress for integration testing or Storybook for component testing / design?

There’s a lot DOM manipulation, so… Yes.