Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanism to reset test environment between test cases #11

Closed
OldSneerJaw opened this issue Apr 2, 2018 · 1 comment
Closed

Mechanism to reset test environment between test cases #11

OldSneerJaw opened this issue Apr 2, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@OldSneerJaw
Copy link
Owner

Feature Request

Description

Currently, to reset the test environment between test cases, it's necessary to initialize a new test fixture, which is inefficient in that it must completely reload the validation function from disk. Furthermore, it can lead to the code editor being unable to autocomplete the test fixture object's properties if the variable's initialization is done in a beforeEach block. Add a function to the test fixture object that can be used to reset the test environment to a pristine state.

Examples

describe('My new validation function', () => {
  const testFixture = testFixtureMaker.initFromDocumentDefinitions('/path/to/my-doc-definitions.js');

  afterEach(() => {
    testFixture.resetTestEnvironment();
  });

  // Test cases...
});
@OldSneerJaw OldSneerJaw added the enhancement New feature or request label Apr 2, 2018
@OldSneerJaw OldSneerJaw self-assigned this Apr 2, 2018
OldSneerJaw added a commit that referenced this issue Apr 2, 2018
Call the test fixture object's `resetTestEnvironment` function between test cases to ensure that each test case has a pristine test environment.
@OldSneerJaw
Copy link
Owner Author

Satisfied by commit 2bf65bd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant