I'm new to Javascript. I have the following code following exactly per https://stackoverflow.com/a/58785118
describe('tests', () => {
beforeEach(async () =>
Promise.resolve('foo').then(result => {
this.dom = result;
})
);
it('works', () => {
console.log(this.dom); // => foo
});
});
When running the test, it complaints
1) tests
"before each" hook for "works":
TypeError: Cannot set property 'dom' of undefined
Did I miss anything?