Skip to content

Commit

Permalink
[Tests] fix native tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 28, 2020
1 parent e2854df commit 6b76dff
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ var test = require('tape');
var defineProperties = require('define-properties');
var isEnumerable = Object.prototype.propertyIsEnumerable;

var missing = {};
var theGlobal = typeof globalThis === 'object' ? globalThis : missing;

var runTests = require('./tests');

test('native', function (t) {
t.equal(typeof global, 'object', 'global is an object');
t.equal(global in global, true, 'global is in global');
test('native', { todo: theGlobal === missing }, function (t) {
if (theGlobal !== missing) {
t.equal(typeof theGlobal, 'object', 'globalThis is an object');
t.equal('globalThis' in theGlobal, true, 'globalThis is in globalThis');

t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(global, 'global'), 'global is not enumerable');
et.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(theGlobal, 'globalThis'), 'globalThis is not enumerable');
et.end();
});

runTests(global, t);
runTests(theGlobal, t);
}

t.end();
});

0 comments on commit 6b76dff

Please sign in to comment.