test-exception.js 584 B

1234567891011121314151617
  1. var fs = require('graceful-fs');
  2. var path = require('path');
  3. var Logger = require('bower-logger');
  4. var Resolver = require('../../../lib/core/resolvers/Resolver');
  5. var defaultConfig = require('../../../lib/config');
  6. var resolver = new Resolver({ source: 'foo' }, defaultConfig(), new Logger());
  7. resolver._createTempDir()
  8. .then(function (dir) {
  9. // Need to write something to prevent tmp to automatically
  10. // remove the temp dir (it removes if empty)
  11. fs.writeFileSync(path.join(dir, 'some_file'), 'foo');
  12. // Force an error
  13. throw new Error('Some error');
  14. })
  15. .done();