Stub/mock process.platform sinon

You don't need Sinon to accomplish what you need. Although the process.platform process is not writable, it is configurable. So, you can temporarily redefine it and simply restore it when you're done testing.

Here's how I would do it:

var assert = require('assert');

describe('changing process.platform', function() {
  before(function() {
    // save original process.platform
    this.originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform');

    // redefine process.platform
    Object.defineProperty(process, 'platform', {
      value: 'any-platform'
    });
  });

  after(function() {
    // restore original process.platfork
    Object.defineProperty(process, 'platform', this.originalPlatform);
  });

  it('should have any-platform', function() {
    assert.equal(process.platform, 'any-platform');
  });
});