no-module.js 645 B

12345678910111213141516171819
  1. var tap = require('tap');
  2. var test = tap.test;
  3. test('no module system', function(t) {
  4. var fs = require('fs');
  5. var vm = require('vm');
  6. var head = fs.readFileSync(require.resolve('../head.js.txt'), 'utf8');
  7. var src = fs.readFileSync(require.resolve('../'), 'utf8');
  8. var foot = fs.readFileSync(require.resolve('../foot.js.txt'), 'utf8');
  9. vm.runInThisContext(head + src + foot, 'semver.js');
  10. // just some basic poking to see if it did some stuff
  11. t.type(global.semver, 'object');
  12. t.type(global.semver.SemVer, 'function');
  13. t.type(global.semver.Range, 'function');
  14. t.ok(global.semver.satisfies('1.2.3', '1.2'));
  15. t.end();
  16. });