How to use the @pollyjs/core.setupMocha function in @pollyjs/core

To help you get started, we’ve selected a few @pollyjs/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / helix-cli / test / testUpCmd.js View on Github external
describe('Integration test for up command', function suite() {
  this.timeout(20000);
  let testDir;
  let buildDir;
  let testRoot;
  let testModules;

  setupPolly({
    recordFailedRequests: true,
    recordIfMissing: false,
    logging: false,
    adapters: [NodeHttpAdapter],
    persister: FSPersister,
    persisterOptions: {
      fs: {
        recordingsDir: path.resolve(__dirname, 'fixtures/recordings'),
      },
    },
  });

  before(async function beforeAll() {
    this.timeout(60000); // ensure enough time for installing modules on slow machines
    testModules = [await getTestModules(), ...module.paths];
  });
github adobe / helix-cli / test / testPublishCmd.js View on Github external
const FASTLY_AUTH = '----';
  const FASTLY_NAMESPACE = '477rh0E5FeeHKlKx5J3QXd';
  const WSK_AUTH = 'nope';
  const WSK_NAMESPACE = '---';

  this.timeout(50000);

  let testRoot;

  // How to create a new recording:
  // 1. update the `FASTLY_AUTH` with the correct value
  // 2. delete the recording.har file in the `fixtures/recordings` directory
  // 3. set the `recordIfMissing` to `true`
  // 4. run the test
  // 5. reset the `FASTLY_AUTH` and `recordIfMissing` to the original values.
  setupPolly({
    recordFailedRequests: true,
    recordIfMissing: false,
    logging: false,
    adapters: [NodeHttpAdapter],
    persister: FSPersister,
    persisterOptions: {
      fs: {
        recordingsDir: path.resolve(__dirname, 'fixtures/recordings'),
      },
    },
  });

  beforeEach(async () => {
    testRoot = await createTestRoot();
    await fs.copyFile(path.resolve(__dirname, 'fixtures', 'default.yaml'), path.resolve(testRoot, 'helix-config.yaml'));
  });
github adobe / helix-cli / test / testDeployCmd.js View on Github external
describe('hlx deploy (custom pipeline)', function suite() {
  this.timeout(60000);

  let testRoot;
  let hlxDir;
  let buildDir;
  let cwd;

  setupPolly({
    recordFailedRequests: true,
    recordIfMissing: false,
    logging: false,
    adapters: [NodeHttpAdapter],
    persister: FSPersister,
    persisterOptions: {
      fs: {
        recordingsDir: path.resolve(__dirname, 'fixtures/recordings'),
      },
    },
    matchRequestsBy: {
      body: false,
      headers: {
        exclude: ['content-length', 'user-agent'],
      },
    },