-(defun chop-suffix (suffix s)
+(require 'cl)
+
+(defun _any (pred seq)
+  (< 0 (count-if pred seq)))
+
+(defun s-ends-with-p (s suffix)
+  "Does S end in SUFFIX?"
+  (let ((pos (- (length suffix))))
+    (and (>= (length s) (length suffix))
+         (string= suffix (substring s pos)))))
+
+(defun s-chop-suffix (s suffix)
   "Remove string 'suffix' if it is at end of string 's'"
   (let ((pos (- (length suffix))))
-    (if (and (>= (length s) (length suffix))
-             (string= suffix (substring s pos)))
+    (if (s-ends-with-p s suffix)
         (substring s 0 pos)
       s)))
 

      (error "%s not found." file))))

(defun guess-test-file ()
  (or (test-file-that-exists "-test")
      (test-file-that-exists "_test")
      (test-file-that-exists "Test")

    (if (file-exists-p file) file nil)))

(defun test-file-name (suffix)
  (format "%s/%s%s.js" (s-chop-suffix (guess-test-folder) "/") (test-file-name-stub) suffix))

(defun test-file-name-stub ()
  (s-chop-suffix (file-name-nondirectory (buffer-file-name)) ".js"))

(defun guess-test-folder ()
  (let ((source-dir (file-name-directory (buffer-file-name))))
