當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript proxyquire.noCallThru函數代碼示例

本文整理匯總了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([]);
  });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:35,代碼來源:publish_spec.ts

示例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');
  });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:25,代碼來源:start_spec.ts

示例3: before

 before(function () {
   proxyq.noCallThru();
   CompositionRootService = proxyq(
     '../../src/services/compositionRootService',
     { vscode },
   ).CompositionRootService;
 });
開發者ID:robertohuertasm,項目名稱:vscode-icons,代碼行數:7,代碼來源:compositionRoot.test.ts

示例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;
 });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:15,代碼來源:install-dependencies_spec.ts

示例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;
  });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:17,代碼來源:install_spec_slow.ts

示例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;
  });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:19,代碼來源:github_spec.ts

示例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;
  });
開發者ID:jangocheng,項目名稱:electron-forge,代碼行數:21,代碼來源:start_spec.ts

示例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;
 });
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:37,代碼來源:ora-handler_spec.ts

示例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
};
開發者ID:riggerthegeek,項目名稱:steeplejack-bunyan,代碼行數:29,代碼來源:helper.ts

示例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 () => {
開發者ID:balloonzzq,項目名稱:electron-forge,代碼行數:31,代碼來源:api_spec_slow.ts


注:本文中的proxyquire.noCallThru函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。