aegir
    Preparing search index...

    Function default

    • Loading fixture files in node and the browser can be painful, that's why aegir provides a method to do this.

      Parameters

      • filePath: string
      • Optionalmodule: string = ''

      Returns Uint8Array<ArrayBufferLike>

      // test/awesome.spec.js
      const loadFixture = require('aegir/utils/fixtures')

      const myFixture = loadFixture('test/fixtures/large-fixture')

      The path to the fixture is relative to the module root.

      If you write a module like interface-ipfs-core which is to be consumed by other modules tests you need to pass in a third parameter such that the server is able to serve the correct files.

      // awesome-tests module
      const loadFixture = require('aegir/utils/fixtures')

      const myFixture = loadFixture('test/fixtures/cool-fixture', 'awesome-tests')