I\'ve run into this issue in real code, but I put together a trivial example to prove the point.
The below code works fine. I\'ve set up a variable in my root desc
describe block is executed before the beforeEach blocks.This is exactly as expected. The problem is that your var trees variable is trying to access orchard before it has been initialized. The body of a describe block is executed before the beforeEach blocks. To solve this problem, the third code snippet is the only way to go.
Jasmine will first execute the describe blocks, and then execute the beforeEach blocks before running each test.