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

Migration guide for version 3.0.0 #1510

Merged
merged 1 commit into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/release-source/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ This page contains the entire Sinon.JS API documentation along with brief int
* [Sandboxes](./sandbox)
* [Utils](./utils)

### Migrating from v1.x to v2.0

Please see our [migration guide](./migrating-to-2.0) for details on migrating to Sinon.JS v2.0
### Migration guides
* Migrating from [v1.x to v2.0](./migrating-to-2.0)
* Migrating from [v2.x to v3.0](./migrating-to-3.0)

### Compatibility

Expand Down
2 changes: 1 addition & 1 deletion docs/release-source/release/fake-timers.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Please refer to the `lolex.install` [documentation](https://github.com/sinonjs/l

*Since `[email protected]`*

`var clock = sinon.useFakeTimers([now, ]prop1, prop2, ...)` is deprecated. To define which methods to fake, please use `config.toFake`.
`var clock = sinon.useFakeTimers([now, ]prop1, prop2, ...)` is no longer supported. To define which methods to fake, please use `config.toFake`.


#### `clock.tick(time);`
Expand Down
2 changes: 1 addition & 1 deletion docs/release-source/release/migrating-to-2.0.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: page
title: Migrating to v2.0 - Sinon.JS
breadcrumb: matchers
breadcrumb: migrating to 2.0
---

Sinon v2.0 is the second major release, we have made several breaking changes in this release as a result of modernising the internals of Sinon. This guide is intended to walk you through the changes.
Expand Down
50 changes: 50 additions & 0 deletions docs/release-source/release/migrating-to-3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
layout: page
title: Migrating to v3.0 - Sinon.JS
breadcrumb: migrating to 3.0
---

As with all `MAJOR` releases in [`semver`](http://semver.org/), there are breaking changes in `sinon@3`.
This guide will walk you through those changes.

## `sinon.stub(object, "method", func)` - Removed
Please use `sinon.stub(obj, "method").callsFake(func)` instead.

```js
var stub = sinon.stub(obj, "stubbedMethod").callsFake(function () {
return 42;
});
```

Codemod available at https://github.com/hurrymaplelad/sinon-codemod

## `sinon.stub(object, property, value)` - Removed
Calling `sinon.stub` with three arguments will throw an Error. This was deprecated with `sinon@2` and has been removed with `sinon@3`

## `sinon.useFakeTimers([now, ]prop1, prop2, ...)` - Removed
`sinon.useFakeTimers()` signature has [changed](./fake-timers). To define which methods to fake, please use `config.toFake`. Other options are now available when configuring `useFakeTimers`. Please consult the [documentation](./fake-timers) for more information.

## Removal of internal helpers
The following internal functions were deprecated as of `[email protected]` and have been removed in `sinon@3`:

* `sinon.calledInOrder`
* `sinon.create`
* `sinon.deepEqual`
* `sinon.format`
* `sinon.functionName`
* `sinon.functionToString`
* `sinon.getConfig`
* `sinon.getPropertyDescriptor`
* `sinon.objectKeys`
* `sinon.orderByFirstCall`
* `sinon.restore`
* `sinon.timesInWorlds`
* `sinon.valueToString`
* `sinon.walk`
* `sinon.wrapMethod`
* `sinon.Event`
* `sinon.CustomEvent`
* `sinon.EventTarget`
* `sinon.ProgressEvent`
* `sinon.typeOf`
* `sinon.extend`