Comparing version 12.0.1 to 13.0.0
@@ -162,6 +162,12 @@ "use strict"; | ||
if (method.callCount !== count) { | ||
var msg = `expected %n to be called ${timesInWords( | ||
count | ||
)} but was called %c%C`; | ||
var msg; | ||
if (typeof count !== "number") { | ||
msg = | ||
`expected ${format(count)} to be a number ` + | ||
`but was of type ${typeof count}`; | ||
failAssertion(this, msg); | ||
} else if (method.callCount !== count) { | ||
msg = | ||
`expected %n to be called ${timesInWords(count)} ` + | ||
`but was called %c%C`; | ||
failAssertion(this, method.printf(msg)); | ||
@@ -168,0 +174,0 @@ } else { |
@@ -223,3 +223,4 @@ "use strict"; | ||
if (this.stack) { | ||
// Omit the error message and the two top stack frames in sinon itself: | ||
// If we have a stack, add the first frame that's in end-user code | ||
// Skip the first two frames because they will refer to Sinon code | ||
callStr += (this.stack.split("\n")[3] || "unknown").replace( | ||
@@ -226,0 +227,0 @@ /^\s*(?:at\s+|@)?/, |
@@ -84,2 +84,5 @@ "use strict"; | ||
var actualDescriptor = getPropertyDescriptor(object, property); | ||
assertValidPropertyDescriptor(actualDescriptor, property); | ||
var isObjectOrFunction = | ||
@@ -151,2 +154,32 @@ typeof object === "object" || typeof object === "function"; | ||
function assertValidPropertyDescriptor(descriptor, property) { | ||
if (!descriptor || !property) { | ||
return; | ||
} | ||
if (!descriptor.configurable && !descriptor.writable) { | ||
throw new TypeError( | ||
`Descriptor for property ${property} is non-configurable and non-writable` | ||
); | ||
} | ||
if ((descriptor.get || descriptor.set) && !descriptor.configurable) { | ||
throw new TypeError( | ||
`Descriptor for accessor property ${property} is non-configurable` | ||
); | ||
} | ||
if (isDataDescriptor(descriptor) && !descriptor.writable) { | ||
throw new TypeError( | ||
`Descriptor for data property ${property} is non-writable` | ||
); | ||
} | ||
} | ||
function isDataDescriptor(descriptor) { | ||
return ( | ||
!descriptor.value && | ||
!descriptor.writable && | ||
!descriptor.set && | ||
!descriptor.get | ||
); | ||
} | ||
/*eslint-disable no-use-before-define*/ | ||
@@ -153,0 +186,0 @@ function getParentBehaviour(stubInstance) { |
@@ -18,3 +18,3 @@ { | ||
], | ||
"version": "12.0.1", | ||
"version": "13.0.0", | ||
"homepage": "https://sinonjs.org/", | ||
@@ -41,7 +41,7 @@ "author": "Christian Johansen", | ||
"test-webworker": "mochify --no-detect-globals --https-server 8080 --no-request-interception test/webworker/webworker-support-assessment.js", | ||
"test-esm": "mocha -r esm test/es2015/module-support-assessment-test.es6", | ||
"test-esm-bundle": "node test/es2015/check-esm-bundle-is-runnable.js", | ||
"test-esm-support": "mocha test/es2015/module-support-assessment-test.mjs", | ||
"check-esm-bundle-runs-in-browser": "node test/es2015/check-esm-bundle-is-runnable.js", | ||
"test-docker-image": "docker-compose up", | ||
"test-runnable-examples": "docs/release-source/release/examples/run-test.sh", | ||
"test": "npm run test-node && npm run test-headless && npm run test-webworker && npm run test-esm", | ||
"test": "npm run test-node && npm run test-headless && npm run test-webworker", | ||
"check-dependencies": "dependency-check package.json --no-dev --ignore-module esm", | ||
@@ -54,3 +54,3 @@ "build": "node ./build.cjs", | ||
"prebuild": "rimraf pkg && npm run check-dependencies", | ||
"postbuild": "npm run test-esm-bundle", | ||
"postbuild": "npm run test-esm-support && npm run check-esm-bundle-runs-in-browser", | ||
"prebuild-docs": "./scripts/update-compatibility.js", | ||
@@ -79,4 +79,4 @@ "prepublishOnly": "npm run build", | ||
"@sinonjs/commons": "^1.8.3", | ||
"@sinonjs/fake-timers": "^8.1.0", | ||
"@sinonjs/samsam": "^6.0.2", | ||
"@sinonjs/fake-timers": "^9.0.0", | ||
"@sinonjs/samsam": "^6.1.1", | ||
"diff": "^5.0.0", | ||
@@ -87,8 +87,8 @@ "nise": "^5.1.0", | ||
"devDependencies": { | ||
"@babel/core": "^7.14.3", | ||
"@sinonjs/eslint-config": "^4.0.2", | ||
"@babel/core": "^7.16.12", | ||
"@sinonjs/eslint-config": "^4.0.5", | ||
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.1", | ||
"@sinonjs/referee": "^8.0.2", | ||
"@sinonjs/referee": "^9.1.1", | ||
"@studio/changes": "^2.2.0", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
"babel-plugin-istanbul": "^6.1.1", | ||
"babelify": "^10.0.0", | ||
@@ -98,13 +98,12 @@ "browserify": "^16.5.2", | ||
"dependency-check": "^4.1.0", | ||
"esm": "^3.2.25", | ||
"husky": "^6.0.0", | ||
"lint-staged": "^11.0.0", | ||
"mocha": "^8.4.0", | ||
"mochify": "^7.1.1", | ||
"lint-staged": "^12.3.2", | ||
"mocha": "^9.2.0", | ||
"mochify": "^9.1.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.3.0", | ||
"prettier": "^2.5.1", | ||
"proxyquire": "^2.1.3", | ||
"proxyquire-universal": "^3.0.1", | ||
"proxyquireify": "^3.2.1", | ||
"puppeteer": "^9.1.1", | ||
"puppeteer": "^13.1.2", | ||
"rimraf": "^3.0.2", | ||
@@ -127,4 +126,7 @@ "shelljs": "^0.8.4" | ||
"exports": { | ||
"require": "./lib/sinon.js", | ||
"import": "./pkg/sinon-esm.js" | ||
".": { | ||
"require": "./lib/sinon.js", | ||
"import": "./pkg/sinon-esm.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
@@ -131,0 +133,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22
64925
5072520
51
+ Added@sinonjs/fake-timers@9.1.2(transitive)
+ Addedpath-to-regexp@6.2.2(transitive)
- Removed@sinonjs/fake-timers@8.1.0(transitive)
- Removedpath-to-regexp@6.3.0(transitive)
Updated@sinonjs/fake-timers@^9.0.0
Updated@sinonjs/samsam@^6.1.1