Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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* () {
module.exports = require('memfs').fs; // eslint-disable-line import/no-extraneous-dependencies
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* () {
jest.mock('fs', () => {
return require('memfs').fs;
});
jest.mock('fs', () => {
const fs = require('memfs').fs
fs.existsSync = () => true
return fs
})
jest.mock('../../../lib/build/entry', () => {})
jest.mock('fs', () => {
return require('memfs').fs;
});
jest.mock('fs', () => require('memfs').fs);
jest.mock('../../utils/app-root', () => ({ appRootPath: '/root' }));
jest.mock('fs', () => require('memfs').fs);
jest.mock('../../utils/app-root', () => ({ appRootPath: '/root' }));
jest.mock('fs', () => require('memfs').fs);
jest.mock('./app-root', () => ({ appRootPath: '/root' }));