31076

Can't find variable: loadFixtures

Question:

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?

Answer1:

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.

Recommend

  • How to pass capabilities as a environmental variable to batch script while running the VSTS build de
  • How use local environment variable with Vagrant?
  • Android add a loading view to an AysncTask
  • TypeScript compilation failure and Karma test execution?
  • Unit testing Javascript anonymous functions
  • What's (by default) on the classpath when you run a Jenkins job?
  • How to use the 'Issue attribute path' in the parameter mapping of jenkins-trigger-plugin
  • Coverage report works in Jenkins using Jacoco but I cannot get coverage report in SonarQube
  • Jenkins pipeline groovy.lang.MissingPropertyException
  • Can I display compiler warnings in Sonar?
  • Maven clean plugin exclude .cvsignore
  • Rails: attributes not being saved even though I called @user.save
  • How to disable security checking in Jenkins?
  • How can I trigger jenkins build on merging github branches?
  • Hudson: What is a good way to store a variable between the two job runs?
  • Jenkins and updating git submodules
  • Grunt + Karma test runner fails with “ReferenceError: module is not defined”
  • Testing an async function with Jasmine in Meteor
  • confuse about the execution order of nested testing suite and specs
  • Maven LifeCycleExecutor with an incomplete configuration error
  • Angular Universal : How to resolve missing names, modules and other weird things
  • web.xml configuration based on Maven profile
  • com.jcraft.jsch.JSchException: Algorithm negotiation fail
  • AngularJS: inject causing error in tests
  • Struts2 simple Application not executing
  • How to install and setup Testswarm?
  • Upgrade from Jenkins Weekly to LTS
  • Hudson - different build targets for different triggers
  • How do I get the number of jobs in a rq queue?
  • How to use SBT with multiple sub project web applications?
  • Zend Framework bassed projects
  • Installing Perl6 and Panda on Ubuntu 15.10. Problems with bootstrap.pl
  • Can my PDF ping my server when it is opened?
  • Android full screen on only one activity?
  • Accessing IRQ description array within a module and displaying action names
  • How do you troubleshoot character encoding problems?
  • How to format a variable of double type
  • How can I remove ASP.NET Designer.cs files?
  • How to Embed XSL into XML