nyc.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* global describe, it */
  2. const NYC = require('../')
  3. const path = require('path')
  4. require('chai').should()
  5. describe('NYC', function () {
  6. describe('_disableCachingTransform', function () {
  7. it('is disabled if cache is "false"', function () {
  8. const nyc = new NYC({cache: false})
  9. nyc._disableCachingTransform().should.equal(true)
  10. })
  11. it('is enabled if cache is "true" and isChildProcess is "true"', function () {
  12. const nyc = new NYC({
  13. cache: true,
  14. isChildProcess: true
  15. })
  16. nyc._disableCachingTransform().should.equal(false)
  17. })
  18. it('is disabled if cache is "true" and isChildProcess is "false"', function () {
  19. const nyc = new NYC({
  20. cache: true,
  21. isChildProcess: true
  22. })
  23. nyc._disableCachingTransform().should.equal(false)
  24. })
  25. })
  26. describe('cacheDirectory', function () {
  27. it('should resolve default cache folder to absolute path', function () {
  28. const nyc = new NYC({
  29. cache: true
  30. })
  31. path.isAbsolute(nyc.cacheDirectory).should.equal(true)
  32. })
  33. it('should resolve custom cache folder to absolute path', function () {
  34. const nyc = new NYC({
  35. cacheDir: '.nyc_cache',
  36. cache: true
  37. })
  38. path.isAbsolute(nyc.cacheDirectory).should.equal(true)
  39. })
  40. })
  41. })