hello, I'm trying to run tests with karma
and I get this error:
user:shadow-quagga$ yarn karma start --single-run
yarn run v1.21.1
$ /home/user/work/node_modules/.bin/karma start --single-run
16 05 2021 09:13:28.366:INFO [karma-server]: Karma v6.3.2 server started at <http://localhost:9876/>
16 05 2021 09:13:28.367:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
16 05 2021 09:13:28.371:INFO [launcher]: Starting browser ChromeHeadless
16 05 2021 09:13:28.623:INFO [Chrome Headless 90.0.4430.212 (Linux x86_64)]: Connected on socket BOp0uUsEZlSbo7HdAAAB with id 30514711
Chrome Headless 90.0.4430.212 (Linux x86_64) ERROR
ReferenceError: test is not defined
at eval (eval at <anonymous> (/home/user/work/zebra/shadow-quagga/node_modules/karma-cljs-test/adapter.js:6:7), <anonymous>:1:15)
at ContextKarma.start (/home/user/work/zebra/shadow-quagga/node_modules/karma-cljs-test/adapter.js:6:7)
at ContextKarma.loaded (<http://localhost:9876/context.js:180:14>)
at <http://localhost:9876/context.html:38:22>
yeah this in JS quagga.runner-test.run
means quagga.runner MINUS test.run
not sure what I'm missing... I have a test build that looks like this
:ci {:target :karma
:output-to "out/ci.js"
:ns-regexp "-test$"}
my karma.conf.js
looks like this
// See <http://karma-runner.github.io/1.0/config/configuration-file.html>
module.exports = function(config) {
config.set({
frameworks: ['cljs-test'],
plugins: ['karma-cljs-test', 'karma-chrome-launcher', 'karma-junit-reporter'],
basePath: 'out',
// If you need to include custom JavaScript files, put them here.
files: [
// We serve all the JS files via Karma's webserver so that you can
// use :optimizations :none. Only test_suite.js is included because
// CLJS does its own module loading.
'ci.js'
],
colors: true,
logLevel: config.LOG_INFO,
client: {
args: ['quagga.runner-test.run'],
singleRun: true
},
// If you don't like the progress reporter, you could try 'dots'
reporters: ['progress', 'junit'],
// If you want to use other browsers, you need to install the launchers
// for them! E.g. npm install --save-dev karma-firefofx-launcher
browsers: ['ChromeHeadless'],
reportSlowerThan: 500, // ms
// We disable autoWatch, because it executes tests while the code is
// still comiling. We use :notify-command to trigger them instead.
autoWatch: false,
// Configuration for JUnit output. We care only about the output directory.
// This directory is relative to basePath, so the XML files will be
// in `target/out/reports`.
// <<https://github.com/karma-runner/karma-junit-reporter#configuration>>
junitReporter: {
outputDir: 'reports'
}
});
}
in the quagga.runner-test
namespace I have a run function that looks like this
(defn ^:export run [karma]
(karma/run-tests
karma
'quagga.events-test))
an in the quagga.events-test
namespace
(ns quagga.events-test
(:require [cljs.test :refer-macros [deftest is testing run-tests]]))
(deftest first-test
(testing "hello world test"
(is (= 1 1))))
actually, I found my issue
seems a _
was expected where I placed a -
Hello, people! Trying to figure out how to configure cljfmt
with shadow-cljs.edn
. Any tips?
you can run it via shadow-cljs run cljfmt.main