Code Monkey home page Code Monkey logo

Comments (8)

rtfeldman avatar rtfeldman commented on August 17, 2024 2

Update: this is fixed on a branch; will be included with the next release!

from node-test-runner.

opsb avatar opsb commented on August 17, 2024

Seems to be an issue with elm-make, added some details at https://github.com/opsb/elm-test-crash#elm-make-scenarios

from node-test-runner.

sjfloat avatar sjfloat commented on August 17, 2024

+1
I spent some quality time identifying this one today.

module Tests exposing (..)

import Test exposing (..)
import Expect
import String

crashingFunction = "blah" |> Debug.crash

all : Test
all =
    describe "A Test Suite"
        [ test "This will crash" <|
            \() ->
                Expect.equal crashingFunction "blah"
        ]

from node-test-runner.

opsb avatar opsb commented on August 17, 2024

@sjfloat nice work isolating that!

from node-test-runner.

sjfloat avatar sjfloat commented on August 17, 2024

Sure. At least I know what to suspect now if I get that behavior in a test.

Thanks for discovering it in the first place!

On Thu, Sep 22, 2016 at 9:56 AM, Oliver Searle-Barnes <
[email protected]> wrote:

@sjfloat https://github.com/sjfloat nice work isolating that!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#69 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANMZ65H5LENpWFa97BzcUfDcYTbXpeWks5qsokegaJpZM4Jyv5k
.

"I have delusions of grandeur. I believe myself to be Steve Jones"

from node-test-runner.

ccapndave avatar ccapndave commented on August 17, 2024

As a workaround, you can explicitly put a Debug.log as well as a Debug.crash, in which case it gets displayed in the elm-test output. For example, this is a function I often use in my tests:

unsafeDecodeString : Decoder a -> String -> a
unsafeDecodeString decoder json =
  let
    result =
      JD.decodeString decoder json
  in
  case result of
    Ok r ->
      r

    Err str ->
      str
        |> Debug.log "unsafeDecodeString"
        |> Debug.crash "unsafeDecodeString"

This will give output like:

success! Compiled 4 modules.
Successfully generated /var/folders/26/cpffj2js733d5kmk6m9w0n840000gn/T/elm_test_1161030-50093-jeoo8k.1g33c2qpvi.js
unsafeDecodeString: "Expecting an object with a field named `id` but instead got: {\"hello\":\"Dave\"}"

from node-test-runner.

zkessin avatar zkessin commented on August 17, 2024

I have used Debug.log in a fuzztest to sample the data to see if it is generating the data I want

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

Just want to note that this is on my radar, and the plan is for any exception in a test to result in a failure with a message reporting the exception. It's nontrivial to implement but definitely doable.

(Adding something like Expect.crashes : (a -> b) -> Expectation also seems doable, but I'd want to consider that separately as a feature.)

from node-test-runner.

Related Issues (20)

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.