     else
       'stylesheet'
     @minifier = minifiers.filter((minifier) => minifier.type is @type)[0]
-    @isTestFile = @path in findTestFiles @config
     Object.freeze this
 
   # Private: Collect content from a list of files and wrap it with
   # require.js module definition if needed.
   # Returns string.
-  _join: (files, callback) ->
+  _join: (files) ->
     debug "Joining files '#{files.map((file) -> file.path).join(', ')}'
  to '#{@path}'"
-    requireFiles = => loadTestFiles files, @config._normalized.conventions.tests
     joined = files.map((file) -> file.cache.data).join('')
-    process.nextTick =>
-      if @type is 'javascript'
-        data = @config._normalized.modules.definition(@path, joined) + joined
-        callback null, (if @isTestFile then data + requireFiles() else data)
-      else
-        callback null, joined
+    if @type is 'javascript'
+      @config._normalized.modules.definition(@path, joined) + joined
+    else
+      joined
 
   # Private: minify data.
   #

sysPath = require 'path'
async = require 'async'
common = require './common'

getTestFiles = (config) ->
  isTestFile = (generatedFile) ->
    generatedFile.lastIndexOf(sysPath.normalize('test/'), 0) is 0 and
    generatedFile.lastIndexOf('vendor') is -1

  joinPublic = (generatedFile) ->
    sysPath.join(config.paths.public, generatedFile)

  joinTo = config.files.javascripts.joinTo
  files = if typeof joinTo is 'string' then [joinTo] else Object.keys(joinTo)
  files.filter(isTestFile).map(joinPublic)

cachedTestFiles = null

findTestFiles = (config) ->
  cachedTestFiles ?= getTestFiles config

sortAlphabetically = (a, b) ->
  if a < b

  _minify: (data, callback) ->
    if @config.optimize
      minify = @minifier?.optimize ? @minifier?.minify
      minify data, @path, callback
    else
      callback null, data

