I started writing tests for my files js, and I get undefinedwhere I don't expect this. Here is my code:
describe('show jasmine testing', function() {
var x;
beforeEach(function() {
x = 3;
});
describe('booleans', function() {
it('should return true', function() {
expect(true).toBe(true);
});
});
describe('ints', function() {
console.log('This is x: ' + x);
expect(x).toBe(3);
});
});
In my tests, intsmy variable is x undefined, so the test always fails. As far as I understand, this should be 3because the block beforeEachstarts before each block describe. What am I missing?
source
share