This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+5 -6
View File
@@ -1,7 +1,6 @@
'use strict';
var hasSymbols = require('has-symbols')();
var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';
var hasToStringTag = require('has-tostringtag/shams')();
var forEach = require('foreach');
var test = require('tape');
var isRegex = require('..');
@@ -61,7 +60,7 @@ test('does not mutate regexes', function (t) {
test('does not perform operations observable to Proxies', { skip: typeof Proxy !== 'function' }, function (t) {
var Handler = function () {
this.trapCalls = 0;
this.trapCalls = [];
};
forEach([
@@ -78,7 +77,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
'setPrototypeOf'
], function (trapName) {
Handler.prototype[trapName] = function () {
this.trapCalls += 1;
this.trapCalls.push(trapName);
return Reflect[trapName].apply(Reflect, arguments);
};
});
@@ -88,7 +87,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
var proxy = new Proxy({ lastIndex: 0 }, handler);
st.equal(isRegex(proxy), false, 'proxy of plain object is not regex');
st.equal(handler.trapCalls, 0, 'no proxy traps were triggered');
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
st.end();
});
@@ -97,7 +96,7 @@ test('does not perform operations observable to Proxies', { skip: typeof Proxy !
var proxy = new Proxy(/a/, handler);
st.equal(isRegex(proxy), false, 'proxy of RegExp instance is not regex');
st.equal(handler.trapCalls, 0, 'no proxy traps were triggered');
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
st.end();
});