You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// in app/modules/session/app-token.jsvarAppToken,config,uuid;uuid=require('node-uuid');config=require('../../config');module.exports=AppToken=(function(){vargenerateSecureToken;functionAppToken(){this.token=generateSecureToken();this.expires=config.get('appTokenExpires');}generateSecureToken=function(){console.log("---> Generating secure token...");returnuuid.v4();};returnAppToken;})();
with a corresponding Jasmine unit test:
// in app/modules/session/app-token-spec.jsvarAppToken;AppToken=require('./app-token');describe('AppToken',function(){returnit("generates uuid version 4 token",function(){varappToken,regex;appToken=newAppToken();console.log("appToken: "+appToken.token);regex='[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}';expect(appToken.token).toMatch(regex);});});
The nodemon is restarted on a change to a *.js file and the 'unit' task is run.
The problem I am facing is that changes to the module app-token.js aren't picked when tests are run up unless I shutdown and restart gulp. My guess that the module is cached because of this require line in the spec:
AppToken = require('./app-token');
If I require it this way, then everything works as expected:
I have a simple module:
with a corresponding Jasmine unit test:
The nodemon is restarted on a change to a *.js file and the 'unit' task is run.
The problem I am facing is that changes to the module
app-token.js
aren't picked when tests are run up unless I shutdown and restart gulp. My guess that the module is cached because of thisrequire
line in the spec:If I require it this way, then everything works as expected:
What can be done, so the changes in the modules are automatically picked up? Thank you.
The text was updated successfully, but these errors were encountered: