Installations
npm install better-expect
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
*
NPM Version
1.1.65
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
tdolsen
Download Statistics
Total Downloads
3,274
Last Day
1
Last Week
1
Last Month
20
Last Year
104
GitHub Statistics
1 Stars
2 Commits
2 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
1.0.0
Package Id
better-expect@1.0.0
Size
2.89 kB
NPM Version
1.1.65
Total Downloads
Cumulative downloads
Total Downloads
3,274
Last day
0%
1
Compared to previous day
Last week
-50%
1
Compared to previous week
Last month
233.3%
20
Compared to previous month
Last year
-42.5%
104
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
1
better-expect
Assert-style handling of exceptions, modeled after better-assert for self-documenting failure messages.
Basically does the opposit of assert
, by expecting an error to be thrown.
Installation
$ npm install better-expect
Example
As with better-assert, expectations can be deactivated with the NO_ASSERT environmental variable.
1var expect = require('better-expect'); 2 3function test() { 4 throw new Error(); 5}; 6 7expect(test); 8// (passes) 9 10expect(function() { return; }); 11// ExpectationError: function() { return; } 12// at Object.<anonymous> (~/better-expect/example.js:10:1) 13// at Module._compile (module.js:449:26) 14// at Object.Module._extensions..js (module.js:467:10) 15// at Module.load (module.js:356:32) 16// at Function.Module._load (module.js:312:12) 17// at Module.runMain (module.js:492:10) 18// at process.startup.processNextTick.process._tickCallback (node.js:244:9)
License
(The MIT License)
Copyright (c) 2013 Torkild Dyvik Olsen torkild@tdolsen.net
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More