       (error "%s not found." file))))
 
 (defun guess-source-file ()
-  (format "%s/%s.js" (chop-suffix "/" (guess-source-folder)) (guess-source-file-name)))
-
+  (unless (looks-like-test-file-name (buffer-file-name))
+    (error "This doesn't look like a test file."))
+  (format "%s/%s.js" (s-chop-suffix (guess-source-folder) "/") (guess-source-file-name)))
 
 (defun guess-source-file-name ()
-  (chop-suffix (concat js2r-test-suffix ".js")
-               (chop-suffix "Test.js"
-                            (chop-suffix "_test.js"
-                                         (chop-suffix "-test.js"
-                                                      (file-name-nondirectory (buffer-file-name)))))))
+  (reduce 's-chop-suffix (possible-test-file-suffixes)
+          :initial-value (file-name-nondirectory (buffer-file-name))))
 
 (defun guess-source-folder ()
   (let ((test-dir (file-name-directory (buffer-file-name))))

      (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")

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

(defun possible-test-file-suffixes ()
  (cons (concat js2r-test-suffix ".js")
        '("Test.js" "_test.js" "-test.js")))

(defun looks-like-test-file-name (file-name)
  (_any (apply-partially 's-ends-with-p file-name)
        (possible-test-file-suffixes)))

(defun jump-to-source-file-other-window (arg)
  (interactive "P")
  (let ((file (guess-source-file)))
