Emit JS Destructuring Syntax #485
Closed
martinklepsch
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
Interesting idea, is this only about keys destructuring? |
Beta Was this translation helpful? Give feedback.
2 replies
-
This was shipped with squint-cljs 0.7.98, here's an example using it to trigger playwright fixtures (require '["@playwright/test" :refer [chromium expect test]])
(def describe (.-describe test))
(def base-uri "http://localhost:3000")
(describe "playwright meets squint"
(fn []
(test "has title"
(fn ^:async title-test
[^js {:keys [page]}]
(js/await (.goto page base-uri))
(js/await (.toHaveTitle (expect page) #"Dynogee")))))) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
Some tools like playwright (popular for UI testing) do some analysis on how functions destructure their arguments to automatically apply fixtures. While this is probably a bit of a questionable design choice it made me wonder if Squint could emit CLJS destructuring as JS destructuring forms? If that makes sense?
Not sure if its worth it but could be interesting to consider so I thought I'd share :)
Thanks for all your awesome work on this @borkdude 🙌
Edit: Vitest also seems to use this pattern.
Beta Was this translation helpful? Give feedback.
All reactions