circleci / bond Goto Github PK
View Code? Open in Web Editor NEWspying for tests
spying for tests
When requiring and compiling I receive the following exception:
...
Caused by: clojure.lang.ExceptionInfo: Assert failed: Argument to ns-publics must be a quoted symbol
(core/and (seq? quoted-ns) (= (first quoted-ns) (quote quote)) (core/symbol? (second quoted-ns))) at line 34 target/out/bond/james.cljc {:file "target/out/bond/james.cljc", :line 34, :column 8, :tag :cljs/analysis-error}
...
Building a local version of bond with a change to line 34 in ns->fn-symbols fixes the problem:
Change (ns-publics ns) to (ns-publics (quote ns)).
I'm relatively new to cljs so am not sure if something else, like project.clj config, is my actual problem. Also, I'm guessing the changed line would need to check for the existence of a quote before quoting if this were to prevent creating new problems.
Thanks
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
Warning
Renovate failed to look up the following dependencies: Failed to look up clojure package org.clojure:clojure
.
Files affected: project.clj
This repository currently has no open or pending branches.
.circleci/config.yml
cljkondo/clj-kondo 2024.08.01
project.clj
org.clojure:clojure 1.10.2
lambdaisland:kaocha 1.91.1392
lambdaisland:kaocha-cloverage 1.1.89
lambdaisland:kaocha-junit-xml 1.17.101
lein-cloverage:lein-cloverage 1.2.4
jonase:eastwood 1.4.3
This bug - http://dev.clojure.org/jira/browse/CLJS-1623 - keeps the bond library from working with advanced compilation on.
As far as I can tell, calling with-spy
(and with-stub!
) seem to not work as expected on functions that have an inline definition (i.e. a function with :inline
defined in the metadata).
(t/deftest a-test
(t/is (= 1 (count (bond/with-spy [inc]
(inc 1)
(bond/calls inc))))))
;; => #'user/a-test
user> (a-test)
FAIL in (a-test) (x.clj:226)
expected: (= 1 (count (bond/with-spy [inc] (inc 1) (bond/calls inc))))
actual: (not (= 1 0))
;; => nil
(t/deftest a-test
(t/is (= 1 (count (bond/with-spy [identical?]
(identical? 1 2)
(bond/calls identical?))))))
;; => #'user/a-test
user> (a-test)
FAIL in (a-test) (x.clj:226)
expected: (= 1 (count (bond/with-spy [identical?] (identical? 1 2) (bond/calls identical?))))
actual: (not (= 1 0))
;; => nil
;; NOTE: `=` is only inlined for its 2 argument form
(t/deftest a-test
(t/is (= 1 (count (bond/with-spy [=]
(= 1 2)
(bond/calls =))))))
;; => #'user/a-test
user> (a-test)
FAIL in (a-test) (x.clj:226)
expected: (= 1 (count (bond/with-spy [=] (= 1 2) (bond/calls =)))
actual: (not (= 1 0))
;; => nil
;; Passes for non-inlined form
(t/deftest a-test
(t/is (= 1 (count (bond/with-spy [=]
(= 1 2 3)
(bond/calls =))))))
;; => #'user/a-test
user> (a-test)
;; => nil
Hey y'all 👋
I recently encountered a problem with bond whilst trying to mock functions generated by HugSQL. I opened an issue on that tool too, because I think those functions should be correctly annotated with :arglists
.
However, I also think that throwing is not the correct behaviour in the absence of an :arglists
annotation. Would it be possible to have a generated warning, or something more benign than a fail? Alternatively, maybe a different error message which highlights the missing :arglists
rather than claiming that any number of arguments is the wrong number of arguments?
I'll happily do up a PR if I get some guidance on your preferred solution.
The sentence
"calls
returns a seq of maps, one for each call to f
b."
in the README
contains the character 'b' which should be omitted. I can open a quick PR to fix this if needed.
We need this PR to merge - cloverage/cloverage#93 - before we can use cloverage with cljc.
Majority (all?) of the work will be reverting stuff from this PR - #14
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (local>circleci/renovate-config:backplane.json5)
I was about to publish a fork of bond that includes more helper functions and such, since as discussed the other week your intention is to keep bond as short and simple as it is today :)
However, I realised there's no license on bond at the moment? Would you be able to declare one?
Bond uses with-redefs which binds the function's var's root to the new definition, which means it is visible to all threads that are currently executing, not necessarily the one in the context of with-spy
or with-stub
, for example
(defn funk [& args] args)
(future
(bond/with-stub! [[funk (constantly -1)]]
(Thread/sleep 10000)
(funk)))
(funk 9) ;; => -1 (redefined function being called outside of with-stub)
;; after ten seconds
(funk 9) ;; => (9)
I was curious if you think using thread-local redefinitions is something you think would be useful here. For example, using https://gist.github.com/gfredericks/7143494
Hello former CircleCI colleagues! 🙋♂️
I've recently been working with python a lot, and I was sorely missing the functionality provided by this library. So I just reimplemented it in python. I hope that's okay?
See here: https://github.com/epgui/pybond
Just wanted to flag it here as a courtesy, and wanted to say that in case this caused any issues I would happily delete the library. But I hope I don't have to! I am also happy to add any text or extra attribution if applicable.
Spec instrumentation as implemented by spec itself and orchestra both work by altering the var root to wrap the original function with extra behaviour that checks the spec registry and raises errors.
Because bond also replaces the var when doing stubbing, this instrumentation gets lost.
I think it would be useful if spec instrumentation was maintained during stubbing, to ensure that any stubbed behaviour adheres to the spec of the real implementation.
One suggestion from @ericfode was that rather than teach bond about spec instrumentation, we could teach the instrumentation about bond. Bond itself would then need some fairly generic code to pick up metadata and apply additional transformations after stubbing.
What do people think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.