TritonDataCenter / node-assert-plus

Extra assertions on top of node's assert module
MIT License
122 stars 25 forks source link

Error in strict mode #47

Open ck97756 opened 1 year ago

ck97756 commented 1 year ago

env: chrome 114

Uncaught TypeError: Cannot assign to read only property 'length' of function 'function(arg, msg) {
          if (!arg) {
            _toss(msg, "true", arg);
          }
        }'
    at assert.js:202:14
    at Array.forEach (<anonymous>)
    at _setExports (assert.js:193:25)
    at node_modules/assert-plus/assert.js (assert.js:211:18)

This happens when try to change read only property 'length' or 'name' at

/* re-export built-in assertions */
    Object.keys(assert).forEach(function (k) {
        if (k === 'AssertionError') {
            out[k] = assert[k];
            return;
        }
        if (ndebug) {
            out[k] = noop;
            return;
        }
        out[k] = assert[k];
    });