Jest implementation to get danger.js to work.

This commit is contained in:
Michael Teeuw 2018-01-25 19:43:09 +01:00
parent 584786eb9f
commit 22e2fdc707
5 changed files with 3495 additions and 8 deletions

View File

@ -2,6 +2,7 @@ language: node_js
node_js: node_js:
- "7" - "7"
before_script: before_script:
- yarn danger ci
- npm install grunt-cli -g - npm install grunt-cli -g
- "export DISPLAY=:99.0" - "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start" - "sh -e /etc/init.d/xvfb start"

View File

@ -1,8 +1,9 @@
import { message, danger } from "danger" import { message, danger } from "danger"
import { includes } from "lodash"
// Add a CHANGELOG entry for app changes // Add a CHANGELOG entry for app changes
const hasChangelog = includes(danger.git.modified_files, "CHANGELOG.md") const hasChangelog = includes(danger.git.modified_files, "CHANGELOG.md")
if (!hasChangelog) { const isTrivial = contains((danger.github.pr.body + danger.github.pr.title), "#trivial")
if (!hasChangelog && !isTrivial) {
warn("Please add a `CHANGELOG.md` entry for your changes.") warn("Please add a `CHANGELOG.md` entry for your changes.")
} }

View File

@ -108,7 +108,7 @@ vows.describe('node-ical').addBatch({
assert.equal(topic.end.getFullYear(), 1998); assert.equal(topic.end.getFullYear(), 1998);
assert.equal(topic.end.getUTCMonth(), 2); assert.equal(topic.end.getUTCMonth(), 2);
assert.equal(topic.end.getUTCDate(), 15); assert.equal(topic.end.getUTCDate(), 15);
assert.equal(topic.end.getUTCHours(), 00); assert.equal(topic.end.getUTCHours(), 0);
assert.equal(topic.end.getUTCMinutes(), 30); assert.equal(topic.end.getUTCMinutes(), 30);
} }
} }
@ -146,7 +146,7 @@ vows.describe('node-ical').addBatch({
} }
, 'has a start datetime' : function(topic) { , 'has a start datetime' : function(topic) {
assert.equal(topic.start.getFullYear(), 2011); assert.equal(topic.start.getFullYear(), 2011);
assert.equal(topic.start.getMonth(), 09); assert.equal(topic.start.getMonth(), 9);
assert.equal(topic.start.getDate(), 11); assert.equal(topic.start.getDate(), 11);
} }
@ -192,7 +192,7 @@ vows.describe('node-ical').addBatch({
} }
, 'has a start' : function(topic){ , 'has a start' : function(topic){
assert.equal(topic.start.tz, 'America/Phoenix') assert.equal(topic.start.tz, 'America/Phoenix')
assert.equal(topic.start.toISOString(), new Date(2011, 10, 09, 19, 0,0).toISOString()) assert.equal(topic.start.toISOString(), new Date(2011, 10, 9, 19, 0,0).toISOString())
} }
} }
} }
@ -208,7 +208,7 @@ vows.describe('node-ical').addBatch({
})[0]; })[0];
} }
, 'has a start' : function(topic){ , 'has a start' : function(topic){
assert.equal(topic.start.toISOString(), new Date(2011, 07, 04, 12, 0,0).toISOString()) assert.equal(topic.start.toISOString(), new Date(2011, 7, 4, 12, 0,0).toISOString())
} }
} }
, 'event with rrule' :{ , 'event with rrule' :{
@ -249,7 +249,7 @@ vows.describe('node-ical').addBatch({
}, },
'task completed': function(task){ 'task completed': function(task){
assert.equal(task.completion, 100); assert.equal(task.completion, 100);
assert.equal(task.completed.toISOString(), new Date(2013, 06, 16, 10, 57, 45).toISOString()); assert.equal(task.completed.toISOString(), new Date(2013, 6, 16, 10, 57, 45).toISOString());
} }
} }
} }
@ -367,7 +367,7 @@ vows.describe('node-ical').addBatch({
assert.equal(topic.end.getFullYear(), 2014); assert.equal(topic.end.getFullYear(), 2014);
assert.equal(topic.end.getMonth(), 3); assert.equal(topic.end.getMonth(), 3);
assert.equal(topic.end.getUTCHours(), 19); assert.equal(topic.end.getUTCHours(), 19);
assert.equal(topic.end.getUTCMinutes(), 00); assert.equal(topic.end.getUTCMinutes(), 0);
} }
} }
}, },

3477
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
"grunt-stylelint": "latest", "grunt-stylelint": "latest",
"grunt-yamllint": "latest", "grunt-yamllint": "latest",
"http-auth": "^3.2.3", "http-auth": "^3.2.3",
"jest": "^22.1.4",
"jshint": "^2.9.5", "jshint": "^2.9.5",
"mocha": "^4.1.0", "mocha": "^4.1.0",
"mocha-each": "^1.1.0", "mocha-each": "^1.1.0",
@ -69,5 +70,12 @@
"socket.io": "^2.0.4", "socket.io": "^2.0.4",
"valid-url": "latest", "valid-url": "latest",
"walk": "latest" "walk": "latest"
},
"jest": {
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
},
"testPathIgnorePatterns": ["\\.snap$", "<rootDir>/build", "<rootDir>/node_modules/" , "<rootDir>/modules/"],
"cacheDirectory": ".jest/cache"
} }
} }