changing global variable values in jasmine test
问题 We use global variables like this for a jasmine test batch in our react app. global.serverVars = { language: 'en-us', context: 'testing', }; In one of the Spec which tests different languages, I want to change value of global.serverVars.language to nl-nl I am not sure how to achieve that. Any suggestion would be helpful. I mean, is it good practice to change global variable values on the fly or there is better approach? 回答1: Why don't you call your global variable in beforeEach or before