Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest release broke require('sinon') #70

Closed
thom-nic opened this issue Oct 22, 2017 · 8 comments
Closed

latest release broke require('sinon') #70

thom-nic opened this issue Oct 22, 2017 · 8 comments

Comments

@thom-nic
Copy link

mkdir newproj && cd newproj
npm init -y
npm i -S sinon@3.2.1
node -e 'require("sinon")'

Ouptut:

~/newproj/node_modules/just-extend/index.js:40
      throw new Error('expected object, got ' + arg);
      ^

Error: expected object, got function FakeXMLHttpRequest(config) {
    EventTargetHandler.call(this);
    this.readyState = FakeXMLHttpRequest.UNSENT;
    this.requestHeaders = {};
    this.requestBody = null;
    this.status = 0;
    this.statusText = "";
    this.upload = new EventTargetHandler();
    this.responseType = "";
    this.response = "";
    this.logError = configureLogError(config);

    if (sinonXhr.supportsTimeout) {
        this.timeout = 0;
    }

    if (sinonXhr.supportsCORS) {
        this.withCredentials = false;
    }

    if (typeof FakeXMLHttpRequest.onCreate === "function") {
        FakeXMLHttpRequest.onCreate(this);
    }
}
    at extend (~/newproj/node_modules/just-extend/index.js:40:13)
    at Object.<anonymous> (~/newproj/node_modules/nise/lib/fake-xhr/index.js:651:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (~newproj/node_modules/nise/lib/fake-server/index.js:3:15)

$ npm ls just-extend
newproj@1.0.0 ~/newproj
└─┬ sinon@3.2.1
  └─┬ nise@1.1.1
    └── just-extend@1.1.24 

$ node --version
v6.11.0

Re: sinonjs/sinon#1591

@erikbarke
Copy link

This bug seems to have appeared in just-extend@1.1.23, sinon@4.0.1 works if I downgrade to just-extend@1.1.22.

@camjackson
Copy link

For those using yarn, you can work around this issue for now by adding this to your package.json:

  "resolutions": {
    "just-extend": "1.1.22"
  }

I'm not sure if there's an equivalent feature for npm. Perhaps someone else can share.

@davedoesdev
Copy link

For npm, you can edit package-lock.json. Replace 1.1.24 with 1.1.22 and change integrity to sha1-MzCvdWyralQnAMZLLk5KoGLVL/8=.

ljharb added a commit to react-dates/react-dates that referenced this issue Oct 22, 2017
@ljharb
Copy link

ljharb commented Oct 22, 2017

Due to the semver range, you don't need a lockfile to work around this - npm install --save-dev just-extend@=1.1.22 should do it.

@ljharb
Copy link

ljharb commented Oct 22, 2017

Specifically, the bug is due to forgetting that functions are objects too: 59fdd5e#commitcomment-25116347 and 59fdd5e#commitcomment-25116346

@aladdin-add
Copy link

aladdin-add commented Oct 22, 2017

Due to the semver range, you don't need a lockfile to work around this - npm install --save-dev just-extend@=1.1.22 should do it.

this fix not working for npm v2 users?

@angus-c
Copy link
Owner

angus-c commented Oct 22, 2017

Very sorry for this. Latest just-extend has the fix (v1.1.26)

@angus-c angus-c closed this as completed Oct 22, 2017
ljharb added a commit to react-dates/react-dates that referenced this issue Oct 23, 2017
@camjackson
Copy link

Thanks for fixing it so quickly @angus-c 👍

devs-cloud pushed a commit to devs-cloud/react-date that referenced this issue Dec 27, 2019
devs-cloud pushed a commit to devs-cloud/react-date that referenced this issue Dec 27, 2019
MarcoAntonioAG added a commit to MarcoAntonioAG/React-dates that referenced this issue Mar 31, 2022
MarcoAntonioAG added a commit to MarcoAntonioAG/React-dates that referenced this issue Mar 31, 2022
MarcoAntonioAG added a commit to MarcoAntonioAG/React-dates that referenced this issue Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants