Question

I want to use JSFiddle to demonstrate a piece of code that includes AngularJS and a Jasmine unit test.

I've found several examples of people usnig JSFiddle with AngularJS and Jasmine, however when I click Run in JSFiddle nothing seems to happen.

Should I be able to run a Jasmine test from within JSFiddle and actually see the test results in the Results window?

Here's a page I found with a bunch of examples of using AngularJS, Jasmine and JSFiddle. I've looked at a few of these in JSFiddle an in each case clicking Run does apparently nothing.
http://eitanp461.blogspot.com/2013/05/javascript-unit-testing-jasmine-and.html

Am I doing something wrong? Is my expectation that I should see something in Results incorrect?

Was it helpful?

Solution

It should have worked on JSFiddle as well provided required resource files to be linked properly and
Checking the console it says that linked files are not found

enter image description here



and checking the link jasmine.js yeah it's not available enter image description here


It might be 'coz of the fact that they have moved their pages so I would suggest you to download required files from jasmine github resource and then test on your local machine.

OTHER TIPS

I am actually use that fiddle with support jasmine v2.0 - fiddle

describe("first suite", function() {
    it('must throw Error', function () {
        expect(101).toBeLarge();
        expect(function() {
            throw new Error('A basePath must be set.')
        }).toThrow(new Error('A basePath must be set.'));
    });
});

This is works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top