How to use the memfs.fs function in memfs

To help you get started, we’ve selected a few memfs 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 thiagodp / concordialang / dist / __tests__ / plugin / PackageBasedPluginFinder.spec.js View on Github external
it('returns class file with path', () => __awaiter(this, void 0, void 0, function* () {
        memfs_1.vol.mkdirpSync(localPluginDir); // local
        memfs_1.vol.writeFileSync(localPluginPackageFile, JSON.stringify(pkg)); // local
        const pkg2 = Object.assign({}, pkg); // copy properties
        pkg2.name += '-global';
        memfs_1.vol.mkdirpSync(globalPluginDir); // global
        memfs_1.vol.writeFileSync(globalPluginPackageFile, JSON.stringify(pkg2)); // global
        const finder = new PackageBasedPluginFinder_1.PackageBasedPluginFinder(currentDir, memfs_1.fs);
        const pluginData = yield finder.find();
        expect(pluginData).toHaveLength(2);
        const first = pluginData[0];
        expect(first.file).toContain(localPluginDir);
    }));
    it('ignores a package that is not a plugin', () => __awaiter(this, void 0, void 0, function* () {
github gfilliere / pg-documentor / src / writer / __mocks__ / fs.js View on Github external
module.exports = require('memfs').fs; // eslint-disable-line import/no-extraneous-dependencies
github thiagodp / concordialang / dist / __tests__ / plugin / PackageBasedPluginFinder.spec.js View on Github external
it('finds in a local module', () => __awaiter(this, void 0, void 0, function* () {
        memfs_1.vol.mkdirpSync(localPluginDir);
        memfs_1.vol.writeFileSync(localPluginPackageFile, JSON.stringify(pkg));
        const finder = new PackageBasedPluginFinder_1.PackageBasedPluginFinder(currentDir, memfs_1.fs);
        const pluginData = yield finder.find();
        expect(pluginData).toHaveLength(1);
        const first = pluginData[0];
        expect(first.name).toEqual(pkg.name);
    }));
    it('finds in a global module', () => __awaiter(this, void 0, void 0, function* () {
github kazupon / vue-cli-plugin-p11n / tests / unit / commands / build.spec.js View on Github external
jest.mock('fs', () => {
    const fs = require('memfs').fs
    fs.existsSync = () => true
    return fs
  })
  jest.mock('../../../lib/build/entry', () => {})
github nrwl / nx / packages / workspace / src / core / affected-project-graph / affected-project-graph.spec.ts View on Github external
jest.mock('fs', () => require('memfs').fs);
jest.mock('../../utils/app-root', () => ({ appRootPath: '/root' }));
github nrwl / nx / packages / workspace / src / core / project-graph / project-graph.spec.ts View on Github external
jest.mock('fs', () => require('memfs').fs);
jest.mock('../../utils/app-root', () => ({ appRootPath: '/root' }));
github nrwl / nx / packages / workspace / src / utils / fileutils.spec.ts View on Github external
jest.mock('fs', () => require('memfs').fs);
jest.mock('./app-root', () => ({ appRootPath: '/root' }));