Skip to content

Why not allow specific config on per test basis? #78

@emahuni

Description

@emahuni

I am new to this plugin, just wondering why not allow tests to set their own patterns and config? I frequently find myself going back to the config to adjust config just for certain tests, of which I don't want adjusting for globally.

ie:

const autoRecord = require('cypress-autorecord'); // Require the autorecord function
  
describe('Test Articles Page', function() { // Do not use arrow functions
 autorecord( {
    interceptPattern: "**/api/v1/items/articles/**",
    // forceRecord: true,
    // cleanMocks: true,
  });
  
  // Your hooks (beforeEach, afterEach, etc) goes here
  
  it('...', function() { // Do not use arrow functions
    // Your test goes here
  });
});

This:

  • makes it clearer what's going on in that particular test
  • allows config to be specific to the test case only
  • allows one to forceRecord / clear mocks on demand for specific test
  • makes everything easier to maintain by separating actual plugin config from tests (I don't want to change configuration only to revert it back because I am working on a particular test I need to recapture data for)

and yes, I have not looked into the source to determine the possibility of this, however, I believe this is a more clearer and more efficient manner to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions