Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: chaijs/sinon-chai
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.7.0
Choose a base ref
...
head repository: chaijs/sinon-chai
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.0.0
Choose a head ref
  • 7 commits
  • 23 files changed
  • 4 contributors

Commits on Apr 29, 2022

  1. Add pointer to chai-samsam for Sinon.assert.match (#156)

    Sinon has one outlier assertion, `Sinon.assert.match`, that is not a spy method, and doesn't make sense to implement as part of this library, so instead add a pointer to `chai-samsam`, which implements a compatible assertion separately.
    cincodenada authored Apr 29, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    faaf5df View commit details
  2. Add brief note about .always prefix (#153)

    This is the only instance (besides the `not` methods) where we don't just tack the method name on the end, so it seems worth a call-out, as it has already confused at least two people per #139
    cincodenada authored Apr 29, 2022
    Copy the full SHA
    e23406f View commit details

Commits on May 13, 2024

  1. Copy the full SHA
    7341f93 View commit details
  2. Set up CI (#163)

    Kristján Oddsson authored May 13, 2024
    Copy the full SHA
    96f3e0a View commit details
  3. Create npm-publish.yml (#164)

    Kristján Oddsson authored May 13, 2024
    Copy the full SHA
    f14909b View commit details
  4. Set version to development since we are deploying from CI

    Kristján Oddsson authored May 13, 2024
    Copy the full SHA
    c7e61e5 View commit details

Commits on Jul 25, 2024

  1. chore: upgrade deps and use c8/prettier (#166)

    43081j authored Jul 25, 2024
    Copy the full SHA
    e22e13f View commit details
Showing with 2,151 additions and 2,653 deletions.
  1. +4 −0 .c8rc.json
  2. +7 −9 .editorconfig
  3. +0 −229 .eslintrc.json
  4. +31 −0 .github/workflows/node.js.yml
  5. +46 −0 .github/workflows/npm-publish.yml
  6. +0 −5 .mocharc.js
  7. +3 −0 .mocharc.json
  8. +10 −0 .prettierrc.json
  9. +4 −2 README.md
  10. +10 −0 eslint.config.js
  11. +185 −139 lib/sinon-chai.js
  12. +1,808 −2,208 package-lock.json
  13. +19 −11 package.json
  14. +2 −5 test/callArguments.js
  15. +2 −5 test/callContext.js
  16. +2 −5 test/callCount.js
  17. +2 −5 test/callOrder.js
  18. +2 −5 test/callingWithNew.js
  19. +4 −5 test/common.js
  20. +3 −5 test/messages.js
  21. +2 −4 test/regressions.js
  22. +2 −5 test/returning.js
  23. +3 −6 test/throwing.js
4 changes: 4 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"reporter": ["lcov"],
"include": ["lib/**/*.js"]
}
16 changes: 7 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
root = true

[*]
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
229 changes: 0 additions & 229 deletions .eslintrc.json

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
46 changes: 46 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish to npm

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build --if-present
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org"
cache: "npm"
- run: npm ci
- run: npm run build --if-present
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.ref_name }}
- run: npm publish --provenance --access public --tag next
if: "github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }}
- run: npm publish --provenance --access public
if: "!github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }}
5 changes: 0 additions & 5 deletions .mocharc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"require": "./test/common.js"
}
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"bracketSpacing": false,
"printWidth": 80,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"arrowParens": "always"
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -60,9 +60,11 @@ For more information on the behavior of each assertion, see
[the documentation for the corresponding spy methods][spymethods]. These of course work on not only spies, but
individual spy calls, stubs, and mocks as well.

Note that you can negate any assertion with Chai's `.not`. E. g. for `notCalled` use `spy.should.have.not.been.called`.
Note that you can negate any assertion with Chai's `.not`. E. g. for `notCalled` use `spy.should.have.not.been.called`. Similarly, note that the `always` methods are accessed with Chai's `.always` prefix; `should.have.been.alwaysCalledWith` will not work - instead, use `should.always.have.been.calledWith`.

For `assert` interface there is no need for this library. You can install [Sinon.JS assertions][sinonassertions] right into Chai's `assert` object with `expose`:
For simplicity, this library intentionally only implements Sinon's spy methods, and does not add an interface for `Sinon.assert.match`. Sinon's matchers are implemented by the `samsam` library, so if you want a should/expect interface to `assert.match` you may be interested in [chai-samsam](https://www.chaijs.com/plugins/chai-samsam/), which adds a `.deep.match` verb that will work with Sinon matchers.

For `assert` interface there is no need for `sinon-chai` or `chai-samsam`. You can install [Sinon.JS assertions][sinonassertions] right into Chai's `assert` object with `expose`:

```javascript
var chai = require("chai");
10 changes: 10 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import eslintjs from '@eslint/js';

const {configs: eslintConfigs} = eslintjs;

export default [
{
...eslintConfigs.recommended,
files: ['lib/**/*.js'],
}
];
Loading