Sha256: 4660dc1e5bc6031ff653e4842ba826078b6e4e8d7c65d2eaa88e49977f1c4f77

Contents?: true

Size: 1.08 KB

Versions: 28

Compression:

Stored size: 1.08 KB

Contents

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

test('graceful fs is not fs', function (t) {
  t.notEqual(fs, require('fs'))
  t.end()
})

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

test('open a non-existing file throws', function (t) {
  var start = fs._curOpen
  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')
  t.equal(fs._curOpen, start)

  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.equal(fs._curOpen, start)
    t.end()
  })
})

Version data entries

28 entries across 23 versions & 7 rubygems

Version Path
blackboard-3.1.9 lib/site_template/node_modules/globule/node_modules/graceful-fs/test/open.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/graceful-fs/test/open.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/graceful-fs/test/open.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.5 template/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-sass/node_modules/node-sass/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-sass/node_modules/node-sass/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.4 template/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.3 template/node_modules/gulp-sass/node_modules/node-sass/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
gulp_assets-1.0.0.pre.3 template/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.16 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.15 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.14 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.13 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.12 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.11 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
entangled-0.0.10 spec/dummy/public/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
trans-0.5.10 template/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js
trans-0.5.10 template/node_modules/grunt/node_modules/glob/node_modules/graceful-fs/test/open.js
trans-0.5.9 template/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/glob/node_modules/graceful-fs/test/open.js