Reputation: 31
I am having problem with running test in my angularjs project -When I run "grunt test" I get:
ReferenceError: io is not defined
I am running server locally through port 3000 which is a node.js socket.io server and implement it in index.html
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
This is the function I am testing:
$scope.editProject = function (dat) {
$http({
method: 'PUT',
url: 'http://some.net/api/project/' + $routeParams.Id,
data: angular.toJson(dat),
headers: {'Content-Type': 'application/json'}
})
.success(function(d) {
var time = $filter('date')(new Date(), 'dd/MM HH:mm:ss');
var loc = '/project/' + $routeParams.Id;
var head = {
User : $rootScope.UserInfo.Username,
Message: 'Some message ',
Name : dat.ProjectName,
url: loc,
date: time,
icon : 'icon-th-list'
};
socket.emit('UpdateHeader', head );
$location.url('/project/' + $routeParams.Id);
});
};
Upvotes: 3
Views: 567
Reputation: 38092
Install the last Yeoman on your project and it solve your problem. This will install Grunt and Bower automatically. After, you can install socket.io client with bower.
grunt test # test your app
grunt server # preview your app
grunt # build the application for deployment
Use Bower component for more package.
Upvotes: 2