 
 # Get all <script> files from public/index.html
 getScriptFilesPath = (htmlFile, callback) ->
-  loadJsdom().env
-    html: htmlFile,
-    done: (error, window) ->
-      throw error if error?
-
-      scripts = window.document.getElementsByTagName('script')
-        .toArray()
-        .filter (script) ->
-          script.src
-        .map (script) ->
-          script.src
-
-      callback scripts
+  document = loadJsdom().jsdom htmlFile, null,
+    features:
+      QuerySelector: true
+  window = document.createWindow()
+  
+  window.document.querySelectorAll('script[src]')
+    .map (script) ->
+      script.src
 
 # Read requires public files
 readTestFiles = (publicPath, callback) ->

    
startBrunchTestRunner = (config, options) ->
  testFiles = helpers.findTestFiles config
  throw new Error("Can't find tests for this project.") if testFiles.length == 0
    
  setupJsDom config.paths.public, (window) =>
    findTestHelpersFile config.paths.test, (testHelpersFile) =>

  mocha
    .reporter(options.reporter or config.test?.reporter or 'spec')
    .ui(config.test?.ui ? 'bdd')
  testFiles.forEach (file) ->
    mocha.addFile file
  mocha.run (failures) ->
    process.exit (if failures > 0 then 1 else 0)

# Load the test-helpers.coffee or test-helpers.js file
