Don't rely on compile cache in babel compilation specs

This commit is contained in:
Max Brunsfeld
2016-01-12 15:41:26 -08:00
parent 389d3d6760
commit bc69e1624b

View File

@@ -1,4 +1,21 @@
path = require('path')
temp = require('temp').track()
CompileCache = require('../src/compile-cache')
describe "Babel transpiler support", ->
originalCacheDir = null
beforeEach ->
originalCacheDir = CompileCache.getCacheDirectory()
CompileCache.setCacheDirectory(temp.mkdirSync('compile-cache'))
for cacheKey in Object.keys(require.cache)
if cacheKey.startsWith(path.join(__dirname, 'fixtures', 'babel'))
console.log('deleting', cacheKey)
delete require.cache[cacheKey]
afterEach ->
CompileCache.setCacheDirectory(originalCacheDir)
describe 'when a .js file starts with /** @babel */;', ->
it "transpiles it using babel", ->
transpiled = require('./fixtures/babel/babel-comment.js')