(require 'ecukes)

(defun kill-js-buffers ()
  (mapc (lambda (buffer)
            (when (string-match "\.js" (buffer-name buffer))
              (kill-buffer (buffer-name buffer))))
          (buffer-list))) 

(After ;; Kill all test buffers
 (when (get-buffer "*mocha tests*")
   (kill-buffer "*mocha tests*"))
 (kill-js-buffers))

(require 'ecukes)
(require 'f)

(defun kill-js-buffers ()
  (mapc (lambda (buffer)
            (when (f-ext? (or (buffer-file-name buffer) "") "js")
              (kill-buffer (buffer-name buffer))))
          (buffer-list))) 

(After ;; Kill all test buffers
 (when (get-buffer "*mocha tests*")
   (kill-buffer "*mocha tests*"))
 (kill-js-buffers))

Use `f-ext?` to detect file extensions.
Use `f-ext?` to detect file extensions.

scottaj/mocha.el