Re: cljs.test :after fixture not called if test errors

2020-11-24 Thread Stuart Campbell
That unfortunately doesn't work for async tests, which require the map
fixture style (with :before/:after keys).

On Tue, 24 Nov 2020 at 21:23, Estevo U. C. Castro 
wrote:

> Try
>
> (use-fixtures :once
>   (fn [f]
> (println "before")
> (try (f)
>   (finally (println "after")
>
> O mércores, 25 de novembro de 2020 á/s 00:17:03 UTC+1,
> stuart.will...@gmail.com escribiu:
>
>> Hello,
>>
>> I'm experimenting with fixtures and it seems like :after fixtures aren't
>> run if a test unexpectedly errors. E.g.:
>>
>> (use-fixtures :once {:before #(println "before")
>>  :after #(println "after")})
>>
>> (deftest a-test
>>   (raise (js/Error. "oops")))
>>
>> In this example I expected to see "after" printed somewhere after the
>> test failed. Is this intentional?
>>
>> (I'm writing some tests for an Electron app using Spectron and want to
>> make sure the app is always shut down after the tests are complete.)
>>
>> Regards,
>> Stuart
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/N28pFLtNWpo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/84dff1cf-6ea0-438c-a4c0-fac097223201n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAFuJp1n1Vz8NKf%3DmxakTYn1EXF8UUqTQwc5NiDUKGMOj-BKBsQ%40mail.gmail.com.


Re: cljs.test :after fixture not called if test errors

2020-11-24 Thread Estevo U. C. Castro
Try

(use-fixtures :once 
  (fn [f]
(println "before") 
(try (f) 
  (finally (println "after")

O mércores, 25 de novembro de 2020 á/s 00:17:03 UTC+1, 
stuart.will...@gmail.com escribiu:

> Hello,
>
> I'm experimenting with fixtures and it seems like :after fixtures aren't 
> run if a test unexpectedly errors. E.g.:
>
> (use-fixtures :once {:before #(println "before")
>  :after #(println "after")})
>
> (deftest a-test
>   (raise (js/Error. "oops")))
>
> In this example I expected to see "after" printed somewhere after the test 
> failed. Is this intentional?
>
> (I'm writing some tests for an Electron app using Spectron and want to 
> make sure the app is always shut down after the tests are complete.)
>
> Regards,
> Stuart
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/84dff1cf-6ea0-438c-a4c0-fac097223201n%40googlegroups.com.


cljs.test :after fixture not called if test errors

2020-11-24 Thread Stuart Campbell
Hello,

I'm experimenting with fixtures and it seems like :after fixtures aren't 
run if a test unexpectedly errors. E.g.:

(use-fixtures :once {:before #(println "before")
 :after #(println "after")})

(deftest a-test
  (raise (js/Error. "oops")))

In this example I expected to see "after" printed somewhere after the test 
failed. Is this intentional?

(I'm writing some tests for an Electron app using Spectron and want to make 
sure the app is always shut down after the tests are complete.)

Regards,
Stuart

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/53969332-2819-48fe-ab01-a27fd3b0cc00n%40googlegroups.com.