Book Image

Learning ClojureScript

By : W. David Jarvis, Allen Rohner
Book Image

Learning ClojureScript

By: W. David Jarvis, Allen Rohner

Overview of this book

Clojure is an expressive language that makes it possible to easily tackle complex software development challenges. Its bias toward interactive development has made it a powerful tool, enabling high developer productivity. In this book, you will first learn how to construct an interactive development experience for ClojureScript.. You will be guided through ClojureScript language concepts, looking at the basics first, then being introduced to advanced concepts such as functional programming or macro writing. After that, we elaborate on the subject of single page web applications, showcasing how to build a simple one, then covering different possible enhancements. We move on to study more advanced ClojureScript concepts, where you will be shown how to address some complex algorithmic cases. Finally, you'll learn about optional type-checking for your programs, how you can write portable code, test it, and put the advanced compilation mode of the Google Closure Compiler to good use.
Table of Contents (15 chapters)
Learning ClojureScript
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
Preface

Testing your application with cljs.test


In this section, we'll take a look at how to configure your ClojureScript application or library for testing. As usual, we'll start by creating a new project for us to play around with:

$ lein new figwheel testing

Unlike previous examples where we spent most of our time in the src directory, we'll play around in a test directory this time. Most JVM Clojure projects will have one already, but since the default Figwheel template doesn't include one, let's make one first (following the same convention used with source directories, that is, instead of src/$PROJECT_NAME, we'll create test/$PROJECT_NAME):

$ mkdir -p test/testing

We'll now want to make sure that Figwheel knows to watch the test directory for file modifications. To do that, we will edit the dev build in our project.clj project's :cljsbuild map so that its :source-paths vector includes both src and test. Your new dev build configuration should look like this:

{:id "dev" 
 :source-paths...