问题
I am using karma, jasmine and phantomjs for my project and when I am executing start karma; I am getting following error:
PhantomJS 1.9.7 (Linux) View:: Login guestRegistration Should call the guestRegistration event when btn-grey is clicked FAILED
ReferenceError: Can't find variable: loadFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:84
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:89
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the checkElementToValidate event when username is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:112
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the checkElementToValidate event when username is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:123
PhantomJS 1.9.7 (Linux) View:: Login Check for blur event Should call the addLoginInputPlaceholder event when login-input is blurred FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:103
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:133
PhantomJS 1.9.7 (Linux) View:: Login Check for focus event Should call the addLoginInputPlaceholder event when login-input is focussed FAILED
ReferenceError: Can't find variable: readFixtures
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:146
ReferenceError: Can't find variable: spyOnEvent
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:154
PhantomJS 1.9.7 (Linux) View:: Login Check whether sendFormdata() triggers submit form Should trigger the submit:form method atleast once FAILED
ReferenceError: Can't find variable: sinon
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/test/javascript/spec/login.view.spec.js:231
PhantomJS 1.9.7 (Linux) ERROR
SyntaxError: Unable to parse JSON string
at /apps/devops/jenkins/home/jobs/UIMod-Jasmine-Karma/workspace/WebContent/js/controllers/common/base.controller.js:107
PhantomJS 1.9.7 (Linux): Executed 21 of 38 (6 FAILED) ERROR (2.36 secs / 1.854 secs)
The error is can't find variable loadFixture. Can anyone tell me what is the reason behind this error?
回答1:
It seems like you're using jasmine-jquery. First make sure you install it with npm. Can you also make sure that your karma.conf.js
has a similar entry:
frameworks: ['jasmine-jquery', 'jasmine']
The order of the frameworks matters.
来源:https://stackoverflow.com/questions/23671089/cant-find-variable-loadfixtures