Installations
npm install mocha-sugar-free
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.1.0
NPM Version
6.1.0
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Joris-van-der-Wel
Download Statistics
Total Downloads
203,756
Last Day
39
Last Week
126
Last Month
2,289
Last Year
33,076
GitHub Statistics
7 Stars
13 Commits
1 Forks
2 Watching
1 Branches
1 Contributors
Bundle Size
5.44 kB
Minified
1.56 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.4.0
Package Id
mocha-sugar-free@1.4.0
Unpacked Size
43.30 kB
Size
7.36 kB
File Count
13
NPM Version
6.1.0
Node Version
10.1.0
Total Downloads
Cumulative downloads
Total Downloads
203,756
Last day
-2.5%
39
Compared to previous day
Last week
-78.5%
126
Compared to previous week
Last month
-34.3%
2,289
Compared to previous month
Last year
71.2%
33,076
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
mocha-sugar-free
Write mocha test cases without using globals or this
. Browserify compatible. Mocha without the sugar.
example
1// Note: this example uses ES6 features, however this module does not require it. 2 3const describe = require('mocha-sugar-free').describe; 4const it = require('mocha-sugar-free').it; 5const assert = require('assert'); 6 7describe('Tutorial', suiteContext => { 8 suiteContext.timeout(100); // a default timeout for tests within this suite 9 10 it('should demonstrate a simple example', () => assert.equal(10 / 2, 5) ); 11 12 // You can use arrow functions, which is not supported in regular mocha: 13 it('should demonstrate that `this` is not used', context => { 14 context.slow(1); // warn that the test is slow if it takes more than 1ms 15 context.timeout(5); // should timeout after 5ms 16 context.enableTimeouts(true); // enable timeout checking (enabled by default in mocha) 17 context.skip(); // mark this test as skipped 18 console.info('You should never see this message because of `skip()`'); 19 }); 20 21 it('should demonstrate that asynchronous tests are defined by an option', context => { 22 setTimeout(() => context.done(), 1000); 23 }, {async: true, timeout: 1500}); 24 25 it({ 26 title: 'should demonstrate all of the options that you can use', 27 fn() { 28 assert.equal(10 / 2, 5); 29 }, 30 async: false, // is this an asynchronous test? 31 // if you return a Promise in your test, you do not have to set this 32 enableTimeouts: true, // same as context.enableTimeouts() 33 timeout: 25, // same as context.timeout() 34 slow: 10, // same as context.slow() 35 skip: false, // always skip this test? 36 skipIfBrowser: false, // skip this test if it is run in a web browser? 37 skipUnlessBrowser: false, // skip this test if it is run in node.js? 38 skipIfWebWorker: false, // skip this test if it is ran in a Web Worker? 39 expectPromise: false // throw an exception if the test function does not 40 // return a Promise (thenable)? 41 }); 42}); 43
Test cases that use mocha-sugar-free
are run in the same way as normal mocha test cases, you can even mix them. You can not use mocha-sugar-free
standalone, you should run your test cases using mocha foo.js
(not node foo.js
)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/13 approved changesets -- score normalized to 0
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
project is not fuzzed
Details
- Warn: no fuzzer integrations found
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
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-12-30
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