test-install.js 769 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict'
  2. const test = require('tap').test
  3. const install = require('../lib/install').test.install
  4. require('npmlog').level = 'error' // we expect a warning
  5. test('EACCES retry once', function (t) {
  6. t.plan(3)
  7. var fs = {}
  8. fs.stat = function (path, cb) {
  9. var err = new Error()
  10. err.code = 'EACCES'
  11. cb(err)
  12. t.ok(true)
  13. }
  14. var gyp = {}
  15. gyp.devDir = __dirname
  16. gyp.opts = {}
  17. gyp.opts.ensure = true
  18. gyp.commands = {}
  19. gyp.commands.install = function (argv, cb) {
  20. install(fs, gyp, argv, cb)
  21. }
  22. gyp.commands.remove = function (argv, cb) {
  23. cb()
  24. }
  25. gyp.commands.install([], function (err) {
  26. t.ok(true)
  27. if (/"pre" versions of node cannot be installed/.test(err.message)) {
  28. t.ok(true)
  29. t.ok(true)
  30. }
  31. })
  32. })