Skip to content
Permalink
Browse files
Changes mocha and should to jest for testing
  • Loading branch information
mikaelbr committed Jan 26, 2017
1 parent 5e39a90 commit 810b2e9438261c9e72cbcf1e88f22c196e4a65af
Showing 10 changed files with 274 additions and 460 deletions.
@@ -4,13 +4,18 @@
"description": "A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)",
"main": "index.js",
"scripts": {
"test": "mocha -R spec",
"test": "jest",
"example": "node ./example/message.js",
"example:mac": "node ./example/advanced.js",
"example:mac:input": "node ./example/macInput.js",
"example:windows": "node ./example/toaster.js",
"lint": "eslint example/*.js lib/*.js notifiers/*.js test/**/*.js index.js"
},
"jest": {
"testRegex": "/test/[^_]*.js",
"testEnvironment": "node",
"setupTestFrameworkScriptFile": "./test/_test-matchers.js"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/mikaelbr/node-notifier.git"
@@ -34,8 +39,7 @@
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"mocha": "^3.2.0",
"should": "^11.1.2"
"jest": "^18.1.0"
},
"dependencies": {
"growly": "^1.3.0",
@@ -0,0 +1,22 @@
expect.extend({
toEndWith(received, actual) {
const pass = endsWith(received, actual);
const message = () =>
`expected ${received} ${pass ? 'not ' : ''} to end with ${actual}`;
return { message, pass };
}
});

function endsWith(subjectString, searchString, position) {
if (
typeof position !== 'number' ||
!isFinite(position) ||
Math.floor(position) !== position ||
position > subjectString.length
) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.lastIndexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
}
File renamed without changes.

0 comments on commit 810b2e9

Please sign in to comment.