How to use the isomorphic-git.cores.create function in isomorphic-git

To help you get started, weโ€™ve selected a few isomorphic-git 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 isomorphic-git / isomorphic-git / __tests__ / test-cores.js View on Github external
it('cores have separate plugins', async () => {
    // Setup
    const { _fs } = await makeFixture('test-cores')
    plugins.set('fs', _fs)
    cores.create('third').set('foo', _fs)
    expect(cores.get('default').has('fs')).toBeTruthy()
    expect(cores.get('default').has('foo')).toBeFalsy()
    expect(cores.get('third').has('fs')).toBeFalsy()
    expect(cores.get('third').get('foo')).toBeTruthy()
  })
  it('plugin schema violation', async () => {
github isomorphic-git / isomorphic-git / __tests__ / test-cores.js View on Github external
it('core.create', async () => {
    // Setup
    const { _fs } = await makeFixture('test-cores')
    cores.get('default').set('fs', _fs)
    let error = null
    try {
      cores.create('second').set('fs', _fs)
    } catch (err) {
      error = err
    }
    expect(error).toBeNull()
    expect(cores.get('second').get('fs')).toBe(_fs)
  })
  it('cores have separate plugins', async () => {
github isomorphic-git / isomorphic-git / __tests__ / __helpers__ / FixtureFS / makeLightningFS.js View on Github external
async function makeLightningFS (dir) {
  const FS = require('@isomorphic-git/lightning-fs')
  const _fs = new FS(`testfs`, {
    wipe: true,
    url: `http://${localhost}:9876/base/__tests__/__fixtures__`
  })
  const core = `core-lightningfs-${i++}`
  cores.create(core).set('fs', _fs)
  plugins.set('fs', _fs) // deprecated
  const fs = new FileSystem(_fs)
  dir = `/${dir}`
  const gitdir = `/${dir}.git`
  await fs.mkdir(dir)
  await fs.mkdir(gitdir)
  return { _fs, fs, dir, gitdir, core }
}
github isomorphic-git / isomorphic-git / __tests__ / __helpers__ / FixtureFS / makeNodeFixture.js View on Github external
async function makeNodeFixture (fixture) {
  const _fs = Object.assign({}, require('fs'))
  const core = `core-node-${i++}`
  cores.create(core).set('fs', _fs)
  plugins.set('fs', _fs) // deprecated

  const fs = new FileSystem(_fs)

  const {
    getFixturePath,
    createTempDir,
    copyFixtureIntoTempDir
  } = require('jest-fixtures')

  const testsDir = path.resolve(__dirname, '..')

  const dir = (await getFixturePath(testsDir, fixture))
    ? await copyFixtureIntoTempDir(testsDir, fixture)
    : await createTempDir()
github isomorphic-git / isomorphic-git / __tests__ / __helpers__ / FixtureFS / makeBrowserFS.js View on Github external
const index = require('../../__fixtures__/index.json')
      const readable = await HTTPRequestFS({
        index,
        baseUrl: '/base/__tests__/__fixtures__/'
      })
      const writable = await InMemoryFS()
      const ofs = await OverlayFS({ readable, writable })
      BrowserFS.initialize(ofs)
      browserFS = BrowserFS.BFSRequire('fs')
      browserFSwritable = writable
    }
    const _fs = Object.assign({}, browserFS)
    browserFSwritable.empty()

    const core = `core-browserfs-${i++}`
    cores.create(core).set('fs', _fs)
    plugins.set('fs', _fs) // deprecated

    const fs = new FileSystem(_fs)

    dir = `/${dir}`
    const gitdir = `/${dir}.git`
    await fs.mkdir(dir)
    await fs.mkdir(gitdir)
    return {
      _fs,
      fs,
      dir,
      gitdir,
      core
    }
  }