pkg.js 513 B

1234567891011121314151617181920
  1. var mdeps = require('../');
  2. var test = require('tap').test;
  3. var path = require('path');
  4. var fs = require('fs');
  5. var dirname = path.join(__dirname, '/pkg');
  6. test('pkg', function (t) {
  7. t.plan(4);
  8. var d = mdeps();
  9. d.on('package', function (pkg_) {
  10. var pkg = JSON.parse(fs.readFileSync(dirname + pkg_.dir + '/package.json'));
  11. pkg.__dirname = path.join(dirname, pkg_.dir);
  12. t.deepEqual(pkg_, pkg);
  13. });
  14. d.end(path.join(__dirname, '/pkg/main.js'));
  15. d.resume();
  16. });