Sha256: 1bb6fc1d0a634a45a4dfd231539d0f703b175d01f8de307d3de48798e384e102

Contents?: true

Size: 897 Bytes

Versions: 182

Compression:

Stored size: 897 Bytes

Contents

var test = require('tap').test
var fs = require('../graceful-fs.js')

test('graceful fs is monkeypatched fs', function (t) {
  t.equal(fs, require('../fs.js'))
  t.end()
})

test('open an existing file works', function (t) {
  var fd = fs.openSync(__filename, 'r')
  fs.closeSync(fd)
  fs.open(__filename, 'r', function (er, fd) {
    if (er) throw er
    fs.close(fd, function (er) {
      if (er) throw er
      t.pass('works')
      t.end()
    })
  })
})

test('open a non-existing file throws', function (t) {
  var er
  try {
    var fd = fs.openSync('this file does not exist', 'r')
  } catch (x) {
    er = x
  }
  t.ok(er, 'should throw')
  t.notOk(fd, 'should not get an fd')
  t.equal(er.code, 'ENOENT')

  fs.open('neither does this file', 'r', function (er, fd) {
    t.ok(er, 'should throw')
    t.notOk(fd, 'should not get an fd')
    t.equal(er.code, 'ENOENT')
    t.end()
  })
})

Version data entries

182 entries across 152 versions & 9 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/graceful-fs/test/open.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/graceful-fs/test/open.js
blackboard-3.1.9 lib/site_template/node_modules/vinyl-fs/node_modules/graceful-fs/test/open.js