Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"let" around multiple specs causes only last spec to execute #163

Open
whamilton42 opened this issue Jun 5, 2017 · 1 comment
Open

"let" around multiple specs causes only last spec to execute #163

whamilton42 opened this issue Jun 5, 2017 · 1 comment

Comments

@whamilton42
Copy link

whamilton42 commented Jun 5, 2017

Observed this behaviour:

(describe "things"
  (it "a"
    (prn "a")
    (should= 1 1))
  (it "b"
    (prn "b")
    (should= 1 1)))

Both tests execute.

(describe "things"
  (let [x 123]
    (it "a"
      (prn "a")
      (should= 1 1))
    (it "b"
      (prn "b")
      (should= 1 1))))

Only the second test executes.

Is this expected behaviour? What's happening?

trptcolin added a commit that referenced this issue Jun 5, 2017
Before this commit, inside a `describe` speclj would only install the
component returned by each inner expression. This moves installation to
the place where components are created, so that test code like this
works as expected and runs 2 tests instead of just 1:

(let [x 1]
  (it "works 1" (= x 1))
  (it "works 2" (= x 1)))

This has always been a bit of a stumbling block, and while we'd normally
use an `around` or similar to contextualize code, there's no reason I
can see that this shouldn't just work.

refs #163
@mdwhatcott
Copy link
Collaborator

Resolved by #164

@trptcolin trptcolin reopened this Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants