Skip to content

Commit

Permalink
introduce test-suite sinon
Browse files Browse the repository at this point in the history
Starting of introducing test-suite to project. Test-suite: sinon.
If this is a good choice, then the next step will be to introduce chai, and chai as Promise, followed by building out the tests.
  • Loading branch information
gino247 committed May 3, 2020
1 parent 2dcc820 commit dae66d3
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 149 deletions.
6 changes: 6 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
require: [
'./test/setup.spec.js',
],
spec: './test/unit/**/*.js'
};
9 changes: 9 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"check-coverage": true,
"extension": [
".js"
],
"include": [
"lambda/**/*"
]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"execute": "bash execute.sh",
"lint": "eslint --ignore-path .gitignore .",
"test": "mocha",
"coverage": "nyc --reporter=lcov npm run test"
"coverage": "nyc --reporter=lcov --reporter=cobertura --reporter=text-summary mocha"
},
"dependencies": {},
"devDependencies": {
Expand All @@ -36,6 +36,7 @@
"eslint-config-strongloop": "^2.1.0",
"expect.js": "^0.3.1",
"mocha": "^6.2.2",
"nyc": "^14.1.1"
"nyc": "^14.1.1",
"sinon": "^9.0.2"
}
}
12 changes: 12 additions & 0 deletions test/setup.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const sinon = require('sinon');

// hide all logging for tests
// comment out the line which
// you would like to see logged
// during test run
sinon.stub(console, 'log');
sinon.stub(console, 'info');
sinon.stub(console, 'debug');
sinon.stub(console, 'error');
Loading

0 comments on commit dae66d3

Please sign in to comment.