运行测试运行程序时出现阴影错误



我有以下shadow-cljs.edn文件。我正在尝试从浏览器中的测试目录运行测试:

{:deps true
:source-paths ["src"]
:dependencies [[reagent "0.10.0"]
[re-frame "0.12.0"]
[re-frame-steroid "0.1.1"]
[rn-shadow-steroid "0.2.1"]
[re-frisk-remote "1.3.3"]
[cljs-ajax/cljs-ajax "0.8.1"]
[day8.re-frame/http-fx "0.2.2"]]
:builds
{:test {:target :browser-test
:test-dir "test/humboi"
:runner-ns humboi.core
:devtools  {:http-port          8021
:http-root          "test/humboi"}
}
:dev
{:target     :react-native
:init-fn    humboi.core/init
:output-dir "app"
:compiler-options {:closure-defines
{"re_frame.trace.trace_enabled_QMARK_" true}}
:devtools   {:after-load steroid.rn.core/reload
:build-notify steroid.rn.core/build-notify
:preloads [re-frisk-remote.preload]}}}}

我正在尝试从以下文件运行测试:

(ns humboi.core-test
(:require [humboi.core :as sut]
["@testing-library/react-native" :refer [render fireEvent]]
[humboi.auth.core :refer [google-sign-in-comp]]
[cljs.test :as t :include-macros true]))
(defn mount! [component]
(render (r/as-element component)
#js {:container (testing-container)}))
(deftest google-login-test
(is (mount! [google-sign-in-comp])))
(defn start [] (cljs.test/run-tests))
(defn stop [done]
;; stopping the tests
(done))
(defn ^:export init []
(start))

但是在repl上运行(shadow/watch:test(时,我得到了以下错误:

(shadow/watch :test)
[:test] Configuring build.
[:test] Compiling ...
[:test] Build failure:
Failed to inspect file
/Users/prikshetsharma/Desktop/Humboi/node_modules/react-native/index.js
Errors encountered while trying to parse file
/Users/prikshetsharma/Desktop/Humboi/node_modules/react-native/index.js
{:line 13, :column 7, :message "cannot use keyword 'typeof' here."}

如何修复此错误?

不能使用:browser-test:node-test目标运行react-native测试。

react-native包必须由react-native使用的metro绑定器编译,因为它们包含shadow cljs不直接支持的代码(例如flow、typescript等(。

最新更新