box / box/leche

Request - Access to global variables in `withData` function

Open
#26 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
102
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Currently as implemented, I don't have access to any of my spec files' global variables (i.e. they're all undefined).

However, this is only the case when my `withData` call is the direct descendant of a `describe` block. It is not an issue if the ancestory goes: `describe` -> `it` -> `withData`; but this limits my ability to output meaningful spec names, as I will then have nested `it`s (i.e. `it` -> `withData` ->`it` -> `expect`), which seems to then output all of these `spec`s at the bottom of the Karma output.

Let me know if you have any questions on my error, as I realize this sounds a little confusing!

**Edit**: Even weirder than I initially thought, I do have access to global variables, but the one I'm trying to access (an object) has all of its properties cleared out.

**Edit 2**: After looking at it more, I think the root of the problem is that Leche expects `withData` to be called as code that's a direct descendant of `describe` blocks, which in Mocha seems to not play nicely. So this way I can't have access to any global mock data that I may have. Any workaround for this with Leche?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.