readme-issue.js 672 B

123456789101112131415161718192021222324252627282930313233343536
  1. var test = require("tap").test
  2. var glob = require("../")
  3. var mkdirp = require("mkdirp")
  4. var fs = require("fs")
  5. var rimraf = require("rimraf")
  6. var dir = __dirname + "/package"
  7. test("setup", function (t) {
  8. mkdirp.sync(dir)
  9. fs.writeFileSync(dir + "/package.json", "{}", "ascii")
  10. fs.writeFileSync(dir + "/README", "x", "ascii")
  11. t.pass("setup done")
  12. t.end()
  13. })
  14. test("glob", function (t) {
  15. var opt = {
  16. cwd: dir,
  17. nocase: true,
  18. mark: true
  19. }
  20. glob("README?(.*)", opt, function (er, files) {
  21. if (er)
  22. throw er
  23. t.same(files, ["README"])
  24. t.end()
  25. })
  26. })
  27. test("cleanup", function (t) {
  28. rimraf.sync(dir)
  29. t.pass("clean")
  30. t.end()
  31. })