 
     describe 'when the given file is CSON', ->
       it 'compiles the file to JSON and caches it', ->
-        CompileCache.addPathToCache(path.join(fixtures, 'cson.cson'), atomHome)
-        expect(CSONParser.parse.callCount).toBe 1
+        spyOn(CSON, 'setCacheDir').andCallThrough()
+        spyOn(CSON, 'readFileSync').andCallThrough()
 
         CompileCache.addPathToCache(path.join(fixtures, 'cson.cson'), atomHome)
-        expect(CSONParser.parse.callCount).toBe 1
+        expect(CSON.readFileSync).toHaveBeenCalledWith(path.join(fixtures, 'cson.cson'))
+        expect(CSON.setCacheDir).toHaveBeenCalledWith(path.join(atomHome, '/compile-cache'))
+
+        CSON.readFileSync.reset()
+        CSON.setCacheDir.reset()
+        CompileCache.addPathToCache(path.join(fixtures, 'cson.cson'), atomHome)
+        expect(CSON.readFileSync).toHaveBeenCalledWith(path.join(fixtures, 'cson.cson'))
+        expect(CSON.setCacheDir).not.toHaveBeenCalled()
 
   describe 'overriding Error.prepareStackTrace', ->
     it 'removes the override on the next tick, and always assigns the raw stack', ->

    spyOn(Babel, 'transform').andReturn {code: 'the-babel-code'}
    spyOn(CoffeeScript, 'compile').andReturn {js: 'the-coffee-code', v3SourceMap: "{}"}
    spyOn(TypeScriptSimple::, 'compile').andReturn 'the-typescript-code'
    spyOn(CSONParser, 'parse').andReturn {the: 'cson-data'}

  afterEach ->
    CSON.setCacheDir(CompileCache.getCacheDirectory())

CoffeeScript = require 'coffee-script'
{TypeScriptSimple} = require 'typescript-simple'
CSON = require 'season'
CompileCache = require '../src/compile-cache'

describe 'CompileCache', ->
