day 303 — code 365

Wed 12 Oct 2016

Sinon

Learnt how to stub a promise using Sinon today:

let asyncPromiseStub = stub().returns(Promise.resolve());

This means that stub represents the original function having been called, with the .then() already called.

Also learnt that we can pass functions into simulate events:

wrapper.find('.btn').at(1).simulate('click', { preventDefault: () => {} });

NPM

Read about Yarn today — it sounds really really good. A collaborative effort between Facebook, Google, Exponent, and Tilde!

One of the benefits:

The npm client installs dependencies into the nodemodules directory non-deterministically. This means that based on the order dependencies are installed, the structure of anodemodules directory could be different from one person to another. These differences can cause “works on my machine” bugs that take a long time to hunt down.

And there are emojis!

Also learnt how to publish a repo to NPM:

  1. Make changes
  2. Once happy, up-version in package.json
  3. Then make an upversion commit
  4. Then, npm publish

Done!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.