Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test can not find sources with legacy javascript (no ams module) #199

Open
Prideth opened this issue Mar 13, 2018 · 0 comments
Open

Test can not find sources with legacy javascript (no ams module) #199

Prideth opened this issue Mar 13, 2018 · 0 comments

Comments

@Prideth
Copy link

Prideth commented Mar 13, 2018

I tried to get karma, jasmine working. But when i run the tests. I get to following error

PhantomJS 2.1.1 (Windows 8 0.0.0) TestSuite firstTest FAILED
        ReferenceError: Can't find variable: example in test/specs/index.spec.js (line 10)
        test/specs/index.spec.js:10:21
        loaded@http://localhost:9876/context.js:162:17
        TypeError: undefined is not an object (evaluating 'b.init') in test/specs/index.spec.js (line 22)

my sources look like this:


var example = {
	exampleFunction: a => [1, 2, 3].map(n => n ** a)

}

And the spec is the following:

describe("TestSuite", function() {
	var a, b, c;

	beforeEach(function() {
    	a = 1;
    	b = new example;
    	c = b.exampleFunction(a);
    	spyOn(b, 'init').andCallThrough();
  	});
 
  	afterEach(function() {
    	a = 0;
    	b = {};
    	c = [];
  	});

	it("firstTest", function() {
		expect(b.init).toBeDefined();
    	expect(c).toBe([1, 2, 3]);
  	});

  	it("secondTest", function() {
    	expect(2).toEqual(4);
  	});

  	it("thirdTest", function() {
    	expect(c).toContain(1);
    	expect(c).toContain(2);
    	expect(c).toContain(4);
  	});
});

Can anybody help me and tell me where the problem is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant