native.js 767 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var test = require('tape');
  3. var defineProperties = require('define-properties');
  4. var isEnumerable = Object.prototype.propertyIsEnumerable;
  5. var missing = {};
  6. var theGlobal = typeof globalThis === 'object' ? globalThis : missing;
  7. var runTests = require('./tests');
  8. test('native', { todo: theGlobal === missing }, function (t) {
  9. if (theGlobal !== missing) {
  10. t.equal(typeof theGlobal, 'object', 'globalThis is an object');
  11. t.equal('globalThis' in theGlobal, true, 'globalThis is in globalThis');
  12. t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
  13. et.equal(false, isEnumerable.call(theGlobal, 'globalThis'), 'globalThis is not enumerable');
  14. et.end();
  15. });
  16. runTests(theGlobal, t);
  17. }
  18. t.end();
  19. });