Git Product home page Git Product logo

commons's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar fearphage avatar havenchyk avatar ljharb avatar mantoni avatar mgred avatar mroderick avatar mshaaban0 avatar sebmaster avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commons's Issues

Recent change is breaking our unit tests

The recent change you've made cace9e6
is breaking all of our unit tests that use @sinonjs/commons with the following error:

/srv/node_modules/collections/_map.js:162
            return this.size;
                        ^

TypeError: Method get Map.prototype.size called on incompatible receiver #<Map>
    at Map.get size [as size] (<anonymous>)
    at Map.get [as length] (/srv/node_modules/collections/_map.js:162:25)
    at /srv/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js:14:29
    at Array.reduce (<anonymous>)
    at copyPrototypeMethods (/srv/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js:7:50)
    at Object.<anonymous> (/srv/node_modules/@sinonjs/commons/lib/prototypes/map.js:5:18)

Is it possible to revert this change? It's being included by other dependencies and full impact is not known at this point.

eslint: overrides should be a list

As per https://eslint.org/docs/user-guide/configuring#specifying-processor, overrides should be a list. This results in this error when using eslint 6.*:

Error: ESLint configuration in node_modules/@sinonjs/commons/.eslintrc.yaml is invalid:
        - Property "overrides" is the wrong type (expected array but got `{"files":"*.test.*","plugins":["mocha"],"env":{"mocha":true},"rules":{"max-nested-callbacks":["warn",6],"mocha/handle-done-callback":"error","mocha/no-exclusive-tests":"error","mocha/no-global-tests":"error","mocha/no-hooks-for-single-case":"off","mocha/no-identical-title":"error","mocha/no-mocha-arrows":"error","mocha/no-nested-tests":"error","mocha/no-return-and-callback":"error","mocha/no-sibling-hooks":"error","mocha/no-skipped-tests":"error","mocha/no-top-level-hooks":"error","local-rules/no-prototype-methods":"off"}}`).

Don't try to call deprecated __proto__

Hi,

when using node --disable-proto=throw, @sinonjs/common is unusable. Here is a simple patch to fix this:

--- a/lib/prototypes/copy-prototype.js
+++ b/lib/prototypes/copy-prototype.js
@@ -11,6 +11,7 @@
             name !== "caller" &&
             name !== "callee" &&
             name !== "arguments" &&
+            name !== "__proto__" &&
             typeof prototype[name] === "function"
         ) {
             result[name] = call.bind(prototype[name]);

Cheers,
Yadd

TypeError: Method get Map.prototype.size called on incompatible receiver #<Map>

Got this error while using @google-cloud/[email protected] which depends on sinonjs/[email protected].

Doing some research about this kind of error, realized something like "When this error is thrown, a function (on a given object), is called with a this not corresponding to the type expected by the function"

Detailed stack trace: TypeError: Method get Map.prototype.size called on incompatible receiver #<Map>
    at Map.get size [as size] (<anonymous>)
    at Map.get [as length] (/srv/node_modules/collections/_map.js:162:25)
    at /srv/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js:14:29
    at Array.reduce (<anonymous>)
    at copyPrototypeMethods (/srv/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js:7:50)
    at Object.<anonymous> (/srv/node_modules/@sinonjs/commons/lib/prototypes/map.js:5:18)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/srv/node_modules/@sinonjs/commons/lib/prototypes/index.js:6:10)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)

Release 1.8.4 breaks ES5 compatibility in older versions of Sinon

The most recent release of @sinonjs/commons (version 1.8.4) breaks ES5 compatibility with older versions of Sinon (version 9 or lower).

node_modules/sinon/node_modules/@sinonjs/commons/lib/prototypes/copy-prototype-methods.js:27
        if (disallowedProperties.includes(name)) {
                                 ^
TypeError: disallowedProperties.includes is not a function

This observed failure is related to the Array.prototype.includes function in the copy-prototype-methods file:
https://github.com/sinonjs/commons/blob/main/lib/prototypes/copy-prototype-methods.js#L27
Older versions of Sinon automatically update to this version of sinonjs/commons and begin failing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.