Giter VIP home page Giter VIP logo

kaocha-cljs2's People

Contributors

alysbrooks avatar andreacrotti avatar ariela147 avatar kommen avatar lucywang000 avatar oxalorg avatar plexus avatar royalaid avatar skylize avatar stelcodes avatar valdermeyder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kaocha-cljs2's Issues

`:kaocha.type/cljs2` CPU load and performance

The more tests I am adding the more often they are failing because of timeouts.

Background

I have started to write client tests using @testing-library and everything was quite okay in the beginning but after some time I have started to receive Timeout errors like the below one.

Kaocha: Syntax error (ExceptionInfo) compiling at (/private/var/folders/86/2tqdp6j561z4z540d98w4ydw0000gp/T/form-init12547904487930344475.clj:1:126).
Timeout

I have increased the wait time for @testing-library to 14000 and this helped to have them stable for some time.
It is worth adding that the lowest resources were on machines the more often I got those errors. Because of that I have stopped using kaocha-cljs2 on CI and came back to karma there.
My Mac becomes very loud when I run tests and on the Activity Monitor, I can see how jvm and Chromium are taking most of the resources during the run (more than 100%)

The tests are not failing when Chui UI is used and I can easily run all of them there, but when I am trying to run them from the command line using kaocha :type :kaocha.type/cljs2 and headless browser they are failing on one or another async test.

Workaround

The one thing which helps me right now is splitting all my tests in chunks using :skip-meta and :focus-meta and run them one by one using :kaocha.type/cljs2

Questions

Could it be that :kaocha.type/cljs2 doesn't clean up properly between tests and keeps everything until the end of the run in either browser or jvm?

`kaocha.report/documentation` reporter doesn't show `testing` text in reports

kaocha.report/documentation reporter doesn't show testing text in reports for cljs.test package. Works fine when clj.test package is used

For the example below

(ns login.core-tests
  (:require [cljs.test :refer [deftest testing is]]))

(deftest login-logo-test
  (testing ("logo should be shown")))

Expected result

login.core-tests
  login-logo-test
    logo should be shown

Current result

login.core-tests
  login.core-tests/login-logo-test

timeout not respected in all cases

hello. in the config you can specify :kaocha.cljs2/timeout xxx and that gets passed through to the funnel client listen! function https://github.com/lambdaisland/kaocha-cljs2/blob/main/src/kaocha/cljs2/funnel_client.clj#L53 for the 'load' of the tests from the initial config. when it comes to the next stage of loading - getting tests from the clients, the timeout is not passed on - it is nil.

Note. this description ^^^ might not be quite right. the process of loading and running in kaocha is not completely clear to me. but the first time listen! is called the timeout is there, and the next time it is nil - that I can say for sure

so... in an attempt to get my suites passing I have changed this line in my branch https://github.com/henryw374/kaocha-cljs2/blob/main/src/kaocha/type/cljs2.clj#L99 - to call add-timeouts before the load. this seems to work...

Cljdoc builds fail due to kaocha.cljs2.autorequire

Cljdoc attempts to require the kaocha.cljs2.autorequire namespace. Unfortunately, this fails when required from the ClojureScript process, as this namespace must be run from a testable.

(assert (= :kaocha.type/cljs2 (:kaocha.testable/type testable/*current-testable*)))

filter-focus ignored if tests are run from a namespace called 'cljs

hello. I found a weird bug that took quite some time to track down...

calling (run) function in this ns does not filter tests as expected. If I move the fn into a namespace with some other name, things work

(ns cljs)

(defn run []
  (kaocha.repl/run
            {:kaocha/tests
             [{:kaocha.testable/id   :browser-tests
               :kaocha.testable/type :kaocha.type/cljs2}]
             :kaocha.filter/focus [:skip-me  ]}))

Kaocha-cljs2 appears to hang when no clients connect

If no chui-remote clients are connected, Kaocha will wait forever. You can configure a timeout, but it's not enabled by default.

This is technically correct behavior and thus, arguably, not a true hang (which implies a deadlock or other invalid state), but it isn't very friendly to people setting it up for the first time.

Tests not found

Hi,

I am using a different file organization than the default one. Tests files are located in ./src/test without special filenames. Just like for regular Kaocha, in Kaocha-CLJS I was using this sort of configuration:

{:id                                 :node
  :type                            :kaocha.type/cljs
  :kaocha/ns-patterns    [".+"]
  :kaocha/source-paths ["src/main"]
  :kaocha/test-paths      ["src/test"])

However, with Kaocha-CLJS2, I get:

WARNING: No tests were found, make sure :test-paths and :ns-patterns are configured correctly in tests.edn.

I have no idea if I am doing something wrong or if, for some reason, those options are not supported. I have a bit of a trouble migrating from version 1 for node + Chui for browser to version 2 for everything.

watch mode doesn't play well with cljs reload

I started a kaocha watch in shadow-cljs clj-repl, so that everytime the cljs code changes the test could be auto-run.

yarn shadow-cljs clj-repl
> (kaocha.watch/run (kaocha.repl/config))

However kaocha immediately runs the tests after a file change - before shadow-cljs finishes hot reloading. So it's the old code that gets tested, not the most recent version.

So I guess we need a way to let kaocha/chui-remote to "wait for a shadow-cljs reload event and only then run the tests".

clients need a way to control logging level with shadow runner

kaocha.cljs2.shadow-runner sets logging level to :all by default.

when the call is made to
lambdaisland.chui.test-data/capture-test-data! the entirety of test info is printed to the console. This causes problems when there are a large number of tests - e.g. message is too large for channel when attached to chrome debugger.

I don't see a way for clients to set the logging levels, other than writing a new runner ns similar to the shadow-runner.

`shadow-runner` doesn't work in minimal setup

shadow-runner doesn't work in minimal setup

Expected:

Tests run without problems.

Actual:

shadow-cljs - config: /Users/main/Code/clojure/kaocha-cljs2/shadow-cljs.edn
shadow-cljs - starting via "clojure"
[:test] Compiling ...
========= Running Tests =======================
SHADOW import error /Users/main/Code/clojure/kaocha-cljs2/.shadow-cljs/builds/test/dev/out/cljs-runtime/lambdaisland.chui.remote.js

/Users/main/Code/clojure/kaocha-cljs2/.shadow-cljs/builds/test/dev/out/cljs-runtime/lambdaisland/glogi.cljs:87
  (some-> (logger name) (.setLevel (level lvl))))
                        ^
TypeError: G__19978.setLevel is not a function
    at Object.lambdaisland$glogi$set_level [as set_level] (/Users/main/Code/clojure/kaocha-cljs2/.shadow-cljs/builds/test/dev/out/cljs-runtime/lambdaisland/glogi.cljs:87:25)
    at Object.lambdaisland$glogi$set_levels [as set_levels] (/Users/main/Code/clojure/kaocha-cljs2/.shadow-cljs/builds/test/dev/out/cljs-runtime/lambdaisland/glogi.cljs:92:3)
    at /Users/main/Code/clojure/kaocha-cljs2/.shadow-cljs/builds/test/dev/out/cljs-runtime/lambdaisland/chui/remote.cljs:23:1
    at global.SHADOW_IMPORT (/Users/main/Code/clojure/kaocha-cljs2/out/node-tests.js:64:44)
    at /Users/main/Code/clojure/kaocha-cljs2/out/node-tests.js:1681:1
    at Object.<anonymous> (/Users/main/Code/clojure/kaocha-cljs2/out/node-tests.js:1688:3)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
===============================================
[:test] Build completed. (164 files, 2 compiled, 0 warnings, 3.05s)

Steps to reproduce

  1. Create a minimal shadow-cljs project.
git clone https://github.com/wildwestrom/kaocha2-shadow-test.git && cd kaocha2-shadow-test
  1. Install dependencies
yarn install
  1. Run the :test build
shadow-cljs compile test

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.