diff --git a/spec/compile-cache-spec.coffee b/spec/compile-cache-spec.coffee index 848da6b49..c17ba01e1 100644 --- a/spec/compile-cache-spec.coffee +++ b/spec/compile-cache-spec.coffee @@ -4,7 +4,6 @@ Babel = require 'babel-core' CoffeeScript = require 'coffee-script' {TypeScriptSimple} = require 'typescript-simple' CSON = require 'season' -CSONParser = require 'season/node_modules/cson-parser' CompileCache = require '../src/compile-cache' describe 'CompileCache', -> @@ -20,7 +19,6 @@ describe 'CompileCache', -> 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()) @@ -64,11 +62,18 @@ describe 'CompileCache', -> 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', ->