Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
probedockSetup: {
all: {}
},
probedockPublish: {
all: {}
},
jasmine_node: {
options: {
useHelpers: true
},
all: ['spec/']
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('probedock-grunt');
grunt.loadNpmTasks('grunt-jasmine-node-new');
grunt.registerTask('test', ['probedockSetup', 'jasmine_node', 'probedockPublish']);
grunt.registerTask('default', ['test']);
};
var ProbeDockReporter = require('probedock-grunt-jasmine');
jasmine.getEnv().addReporter(new ProbeDockReporter({
// custom Probe Dock configuration
config: {
project: {
category: 'Frisby'
}
}
}));
$> grunt test
>> Tasks directory "tasks" not found.
Running "probedockSetup:all" (probedockSetup) task
OK
Running "jasmine_node:all" (jasmine_node) task
F
Failures:
1) Frisby Test: Get Brightbit Twitter feed @probedock(tag=test)
[ GET https://api.twitter.com/1/statuses/user_timeline.json?screen_name=brightbit ]
Message:
Expected 410 to equal 200.
Stacktrace:
Error: Expected 410 to equal 200.
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:493:42)
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1074:43)
at Timer.listOnTimeout (timers.js:119:15)
2) Frisby Test: Get Brightbit Twitter feed @probedock(tag=test)
[ GET https://api.twitter.com/1/statuses/user_timeline.json?screen_name=brightbit ]
Message:
Error: Expected 'undefined' to be type 'object' for comparison
Stacktrace:
Error: Expected 'undefined' to be type 'object' for comparison
at _jsonContains (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1238:11)
at jasmine.Matchers.toContainJson (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1186:12)
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:717:24)
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1074:43)
at Timer.listOnTimeout (timers.js:119:15)
3) Frisby Test: Get Brightbit Twitter feed @probedock(tag=test)
[ GET https://api.twitter.com/1/statuses/user_timeline.json?screen_name=brightbit ]
Message:
TypeError: Cannot read property 'id_str' of undefined
Stacktrace:
TypeError: Cannot read property 'id_str' of undefined
at _jsonContainsTypes (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1320:35)
at jasmine.Matchers.toContainJsonTypes (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1201:12)
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:633:24)
at null.<anonymous> (/Users/lprevost/repos/git-hub-probe/probedock-demo-frisby/node_modules/frisby/lib/frisby.js:1074:43)
at Timer.listOnTimeout (timers.js:119:15)
Finished in 1.138 seconds
1 tests, 4 assertions, 3 failures, 0 skipped
util.print: Use console.log instead
Warning: Task "jasmine_node:all" failed. Used --force, continuing.
Running "probedockPublish:all" (probedockPublish) task
Found 2 results to send to Probe Dock
>> Test results successfully published in 0.059s
Done, but with warnings.
{
"name": "probedock-demo-frisby",
"version": "0.0.1",
"description": "Probe Dock demo of Frisby integration",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Laurent Prevost",
"license": "MIT",
"devDependencies": {
"frisby": "^0.8.5",
"grunt": "^0.4.5",
"grunt-jasmine-node-new": "^0.3.2",
"probedock-grunt": "^0.4.0",
"probedock-grunt-jasmine": "^0.2.2"
}
}
var frisby = require('frisby');
frisby.create('Get Brightbit Twitter feed @probedock(tag=test)')
.get('https://api.twitter.com/1/statuses/user_timeline.json?screen_name=brightbit')
.expectStatus(200)
.expectHeaderContains('content-type', 'application/json')
.expectJSON('0', {
place: function(val) { expect(val).toMatchOrBeNull("Oklahoma City, OK"); }, // Custom matcher callback
user: {
verified: false,
location: "Oklahoma City, OK",
url: "http://brightb.it"
}
})
.expectJSONTypes('0', {
id_str: String,
retweeted: Boolean,
in_reply_to_screen_name: function(val) { expect(val).toBeTypeOrNull(String); }, // Custom matcher callback
user: {
verified: Boolean,
location: String,
url: String
}
})
.toss();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.