How to write Unit Test by Including Controller vm in Factory Jasmine

I have created a factory and controller in two different Js files.

My factory is common for couple of other controllers as well.

In my factory I have used the this scope from controller.

app.factory('myFactory', function () {

return {
getMSG: getMSG

function getMSG(params , vm) {

//do some logic here with vm and params since its common factory for some other controller as well.

return value;



app.controller("factoryCtrl", function ($scope, myFactory) {

var vm = this;

vm.message = "12345";
var params = {'id': 123, 'pageNumber': 30};
myFactory.getMSG(params, vm);
Error: [$controller:ctrlreg]$controller/ctrlreg?p0=factoryCtrl 

Source: AngularJS