Git Product home page Git Product logo

purescript-spec-mocha's Introduction

PureScript Spec

Build Status

PureScript Spec is a testing framework for Purescript, inspired by hspec.

Documentation

Changelog

  • 8.0.0

    • runSpec renamed to runSpecPure.
    • runSpecT renamed to evalSpecT.
    • Old versions of runSpec and runSpecT are left in, but deprecated, with the warning pointing to runSpecAndExitProcess from spec-node.
    • Added spec-node docs.
  • 7.6.1

    • Upgraded to Spago Next
    • Dropped support for Pulp and Bower
  • 7.5.1

    • Support for filtering the test tree #139
      • Breaking: the Tree type got a new type parameter, representing node annotations. Previously nodes were always annotated with String (meaning test/group name), now it's a parameter.
    • Integration tests #138
    • Better, more honest support for failFast #140
  • 7.4.1

    • Diff support for TeamCity reporter by @Neppord #136
    • failFast config option to stop on first failure by @fsoikin #137
  • 7.3.0

  • 7.2.0

    • Added a reporter for TeamCity by @Neppord
    • Use unsafeRegex instead of methods from purescript-partial to create a regex by @toastal
  • 7.1.0

    • Added the AnyShow newtype wrapper for asserting on values that don't have a Show instance. By @sigma-andex and @i-am-the-slime in #125
  • 4.0.0

    • Rename run and run' to runSpec and runSpecM.
    • Run tests in Aff instead of Effect.
    • New assertions:
      • Aff: expectError, shouldReturn, shouldNotReturn
      • String: shouldContain, shouldNotContain, shouldStartWith, shouldEndWith
    • Parallel test execution / parallel and sequential combinators
    • Hooks: aroundWith, around, around_, before, before_, beforeWith, beforeAll, beforeAll_, after, after_, afterAll, afterAll_
    • Upgrade to PureScript 0.13.x.
  • 3.1.0

    • Add shouldSatisfy assertion and complement, add exit flag to runner config
  • 3.0.0

    • Upgrade to PureScript 0.12.x, which is non-backwards compatible to 0.11.x.
  • 2.0.0

    • Update to purescript-aff 4
  • 1.0.0

    • No additions from 0.14.0.
  • 0.14.0

    • Remove unused "slow" from Dot reporter config
  • 0.13.0

    • Upgrade to PureScript 0.11.x, which is non-backwards compatible to 0.10.x.
  • 0.12.4

    • Upgrade to purescript-pipes 2.1.0
  • 0.12.3

    • Export and document run' function (for configuration), fixes #38
  • 0.12.2

    • Reexport common reporters in Test.Spec.Reporter module, fixes #37
  • 0.12.1

    • Move array of results to runner event, fixes #36
  • 0.12.0

    • Again support multiple reporters, fixes #33
  • 0.11.0

    • Publish The Guide on GitHub pages
    • Collapse result entries in Maps to deduplicate describes, fixes #9
    • Reimplement Node reporters and runner using purescript-pipes. An upgrade might require a change in your main type signature. The type Test.Spec.Runner.RunnerEffects makes it more convenient to specify all effect rows:
      • When using regular specs, use main :: Effect Unit
      • When using purescript-spec-discovery, use main :: Effect Unit
  • 0.10.0

    • Defer test execution with Aff to have greater control. Test runners can either collect and run all tests, and then report their results, using the provided run and Reporter interface, or they can implement the test run in another way by collecting a Spec and running the Affs in some special way.
  • 0.9.0

    • Upgrade dependencies to 2.x
    • Require PureScript 0.10.x
  • 0.8.0

    • Compatibility with PureScript 0.9.1
  • 0.7.5

    • Bump dependency versions.
  • 0.7.4

    • Use purescript-node-process instead of custom PROCESS effect.
  • 0.7.2

    • Update purescript-strings for PS 0.7.4 compatibility.
    • Make all dependencies flexible.
    • Fix case statements to remove warnings.
  • 0.7.1

  • 0.7.0

    • Rename runNode to run and place it in Test.Spec.Runner.
    • Support browser testing.
  • 0.6.2

    • Add more assertions.
  • 0.6.1

    • Fix bug in shouldContain assertion for strings.
  • 0.6.0

    • Adapt for PureScript 0.7 compatibility.
  • 0.5.0

    • Make reporters pluggable.
  • 0.4.0

    • Add async support in it using Aff.

Contribute

If you have any issues or possible improvements please file them as GitHub Issues. Pull requests are encouraged.

License

MIT License.

Status

Get more details at codescene.io.

purescript-spec-mocha's People

Contributors

alexadewit avatar anttih avatar fsoikin avatar jcsanpedro avatar jmatsushita avatar owickstrom avatar winstonwolff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

purescript-spec-mocha's Issues

Remove "forall e" quantifier in Mocha.purs

At line 45 in src/Test/Spec/Mocha.purs:

runMocha
  :: forall e
   . Spec Unit
 -> Effect Unit

forall e generates the following warning:

Type variable e is ambiguous, since it is unused in the polymorphic type which introduces it.

Use together with discover

I'm looking to use spec-mocha to run tests with the node mocha binary, so that webstorm can show the test results.

This works great, but i can't get it to work together with spec-discovery.

Is there a way around that the types don't match, since spec-mocha don't seam to accept Spec Unit.

Would one need to write a different wrapper around Mocha.

Or is it impossible to make them work together?

It can not be compiled with purs 0.15

Error found:
at .spago/spec-mocha/v4.0.0/src/Test/Spec/Mocha.purs:1:1 - 57:44 (line 1, column 1 - line 57, column 44)

  A CommonJS foreign module implementation was provided for module Test.Spec.Mocha:

    .spago/spec-mocha/v4.0.0/src/Test/Spec/Mocha.js

  CommonJS foreign modules are no longer supported. Use native JavaScript/ECMAScript module syntax instead.

Test reporter hangs on async tests

When I use the mocha test reporter to run a test like the following

main = run [mochaReporter] do
    describe "do something" do
        it "successfully does something" do
            liftEff $ log "hello"
            res <- later' 100 $ return "Alligator"
            liftEff $ log "good bye"
            return unit

, the test page just hangs showing passes: 0 failures: 0 duration: 0s. If I comment out the line containing later', everything works and the test success is shown. In either case the second log message is shown in the console.

(I apologise if this is expected behaviour / a user error. I'm new to purescript and js programming in general.)

Documentation about integrating this with existing Mocha tests

I had a hard time getting this to work with my existing set of non-Purescript specs. You might mention that the example exports a main() function which needs to be called by whatever requires/imports it into the rest of the tests. E.g.:

// all_tests.js
require('my_javascriptspec');
{main) = require('my_purescript_spec');
main();

Maybe this is self-evident to those experienced with Purescript, but for someone just getting started with Purescript, it was unexpected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.