Blocks with shared variable scopes?

Mohsen Azimi me at
Thu May 28 17:36:53 UTC 2020


I was looking at our test code and noticed we do this variable declaration
gymnastic to get it to work:

describe('thing', () => {
let thing: Thing;
beforeEach(() => {
thing = new Thing()
it('does one thing', () => {
it('does other things', () => {

To me, the declaration of thing and binding it in the beforeEach block
seemed kind of weird. In an ideal world I would declare thing in my
beforeEach block and via language features communicate that scope of
beforeEach's callback and describe's callback above should be the same.

Has this come up before? Has there been proposals to address this issue?
Mohsen Azimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list