• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript proxyquire.noCallThru函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ps-node.lookup函数代码示例发布时间:2022-05-25
下一篇:
TypeScript proxyquire.load函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap