本文整理汇总了TypeScript中proxyquire.noCallThru函数的典型用法代码示例。如果您正苦于以下问题:TypeScript noCallThru函数的具体用法?TypeScript noCallThru怎么用?TypeScript noCallThru使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了noCallThru函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
resolveStub = sinon.stub();
makeStub = sinon.stub();
publisherSpy = sinon.stub();
voidStub = sinon.stub();
nowhereStub = sinon.stub();
publishers = ['@electron-forge/publisher-test'];
const fakePublisher = (stub: SinonStub) => class {
private publish: SinonStub;
constructor() {
this.publish = stub;
}
};
publish = proxyquire.noCallThru().load('../../src/api/publish', {
'./make': async (...args: any[]) => makeStub(...args),
'../util/resolve-dir': async (dir: string) => resolveStub(dir),
'../util/read-package-json': {
readMutatedPackageJson: () => Promise.resolve(require('../fixture/dummy_app/package.json')),
},
'../util/forge-config': async () => {
const config = await (require('../../src/util/forge-config').default(path.resolve(__dirname, '../fixture/dummy_app')));
config.publishers = publishers;
return config;
},
'@electron-forge/publisher-test': fakePublisher(publisherSpy),
void: fakePublisher(voidStub),
nowhere: fakePublisher(nowhereStub),
}).default;
publisherSpy.returns(Promise.resolve());
resolveStub.returns(path.resolve(__dirname, '../fixture/dummy_app'));
makeStub.returns([]);
});
示例2: beforeEach
beforeEach(() => {
resolveStub = sinon.stub();
spawnStub = sinon.stub();
shouldOverride = false;
packageJSON = require('../fixture/dummy_app/package.json');
start = proxyquire.noCallThru().load('../../src/api/start', {
'../util/forge-config': async () => ({
pluginInterface: {
overrideStartLogic: async () => shouldOverride,
triggerHook: async () => false,
},
}),
[path.resolve(__dirname, 'node_modules/electron')]: 'fake_electron_path',
'../util/resolve-dir': async (dir: string) => resolveStub(dir),
'../util/read-package-json': {
readMutatedPackageJson: () => Promise.resolve(packageJSON),
},
'../util/rebuild': () => Promise.resolve(),
child_process: {
spawn: spawnStub,
},
}).default;
processOn = sinon.stub(process.stdin, 'on');
});
示例3: before
before(function () {
proxyq.noCallThru();
CompositionRootService = proxyq(
'../../src/services/compositionRootService',
{ vscode },
).CompositionRootService;
});
示例4: beforeEach
beforeEach(() => {
spawnSpy = sinon.stub();
spawnPromise = new Promise((resolve, reject) => {
spawnPromiseResolve = resolve;
spawnPromiseReject = reject;
});
spawnSpy.returns(spawnPromise);
hasYarnSpy = sinon.stub();
install = proxyquire.noCallThru().load('../../src/util/install-dependencies', {
'./yarn-or-npm': {
yarnOrNpmSpawn: spawnSpy,
hasYarn: hasYarnSpy,
},
}).default;
});
示例5: beforeEach
beforeEach(() => {
fetch = (fetchMock as any).sandbox();
nuggetSpy = sinon.stub();
install = proxyquire.noCallThru().load('../../src/api/install', {
'node-fetch': fetch,
nugget: (...args: any[]) => {
nuggetSpy(...args);
args[args.length - 1]();
},
'@electron-forge/installer-dmg': MockInstaller,
'@electron-forge/installer-zip': MockInstaller,
'@electron-forge/installer-deb': MockInstaller,
'@electron-forge/installer-rpm': MockInstaller,
'@electron-forge/installer-exe': MockInstaller,
}).default;
});
示例6: beforeEach
beforeEach(() => {
gitHubSpy = sinon.spy();
gitHubAuthSpy = sinon.spy();
MockGitHub = class {
private options: any;
constructor(options: any) {
gitHubSpy();
this.options = options;
}
authenticate() {
gitHubAuthSpy();
}
};
GitHub = proxyquire.noCallThru().load('../src/util/github', {
'@octokit/rest': MockGitHub,
}).default;
});
示例7: beforeEach
beforeEach(() => {
resolveStub = sinon.stub();
spawnStub = sinon.stub();
shouldOverride = false;
packageJSON = require('../fixture/dummy_app/package.json');
start = proxyquire.noCallThru().load('../../src/api/start', {
'../util/forge-config': async () => ({
pluginInterface: {
overrideStartLogic: async () => shouldOverride,
triggerHook: async () => false,
},
}),
'../util/resolve-dir': async (dir: string) => resolveStub(dir),
'../util/read-package-json': () => Promise.resolve(packageJSON),
'../util/rebuild': () => Promise.resolve(),
child_process: {
spawn: spawnStub,
},
}).default;
});
示例8: beforeEach
beforeEach(() => {
currentOra = undefined;
mockOra = (text) => {
currentOra = {
failed: false,
start() {
this.started = true;
return currentOra;
},
succeed() {
this.succeeded = true;
return currentOra;
},
fail() {
this.failed = true;
return currentOra;
},
stop() {
this.failed = true;
return currentOra;
},
get text() {
return (currentOra! as any)._text;
},
set text(newText) {
(currentOra! as any)._text = newText;
},
} as any;
(currentOra as any).succeeded = false;
(currentOra as any).failed = false;
(currentOra as any)._text = text;
return currentOra;
};
asyncOra = proxyquire.noCallThru().load('../src/ora-handler', {
'./ora': mockOra,
}).default;
});
示例9: require
/* Node modules */
/* Third-party modules */
/* Files */
import * as chai from "chai";
let chaiAsPromised = require("chai-as-promised");
import * as proxyquire from "proxyquire";
import * as sinon from "sinon";
let sinonAsPromised = require("sinon-as-promised");
import sinonChai = require("sinon-chai");
chai.use(sinonChai);
chai.use(chaiAsPromised);
let expect = chai.expect;
proxyquire.noCallThru();
export {
expect,
proxyquire,
sinon
};
示例10: require
import path from 'path';
import { expect } from 'chai';
import proxyquire from 'proxyquire';
import { createDefaultCertificate } from '@electron-forge/maker-appx';
import installDeps from '../../src/util/install-dependencies';
import { readRawPackageJson } from '../../src/util/read-package-json';
import yarnOrNpm from '../../src/util/yarn-or-npm';
import { InitOptions } from '../../src/api';
const asar = require('asar');
const nodeInstallerArg = process.argv.find(arg => arg.startsWith('--installer=')) || `--installer=${yarnOrNpm()}`;
const nodeInstaller = nodeInstallerArg.substr(12);
const forge = proxyquire.noCallThru().load('../../src/api', {
'./install': async () => {},
}).api;
describe(`electron-forge API (with installer=${nodeInstaller})`, () => {
let dir: string;
let dirID = Date.now();
const ensureTestDirIsNonexistent = async () => {
dir = path.resolve(os.tmpdir(), `electron-forge-test-${dirID}`);
dirID += 1;
await fs.remove(dir);
};
const beforeInitTest = (params?: Partial<InitOptions>, beforeInit?: Function) => {
before(async () => {