How to use the mock-require.reRequire function in mock-require

To help you get started, we’ve selected a few mock-require 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 OldSneerJaw / synctos / src / testing / test-environment-maker.spec.js View on Github external
beforeEach(() => {
    // Mock out the "require" calls in the module under test
    fsMock = { readFileSync: simpleMock.stub() };
    mockRequire('fs', fsMock);

    vmMock = { runInThisContext: simpleMock.stub() };
    mockRequire('vm', vmMock);

    testEnvironmentMaker = mockRequire.reRequire('./test-environment-maker');
  });
github OldSneerJaw / synctos / src / loading / file-fragment-loader.spec.js View on Github external
beforeEach(function() {
    // Mock out the "require" calls in the module under test
    fsMock = { readFileSync: simpleMock.stub() };
    mockRequire('fs', fsMock);
    fileFragmentLoader = mockRequire.reRequire('./file-fragment-loader.js');
  });
github blackbaud / skyux-builder / test / config-webpack-build-public-library.spec.js View on Github external
it('should expose a getWebpackConfig method', () => {
    const lib = mock.reRequire(configPath);
    expect(typeof lib.getWebpackConfig).toEqual('function');
  });
github blackbaud / skyux-builder / test / config-webpack-build-public-library.spec.js View on Github external
it('should return a config object', () => {
    const lib = mock.reRequire(configPath);
    const config = lib.getWebpackConfig(skyPagesConfig);
    expect(config).toEqual(jasmine.any(Object));
  });
github blackbaud / skyux-builder / test / index.spec.js View on Github external
it('should expose a runCommand method', () => {
    const lib = mock.reRequire('../index');
    expect(typeof lib.runCommand).toEqual('function');
  });
github academia-de-codigo / noire-server / test / config / index.js View on Github external
it('requires common config file', () => {
        //setup
        process.env.NODE_ENV = 'dev';

        //exercise
        config = Mock.reRequire('config');

        //verify
        expect(config).to.be.an.object();
        expect(config.common).to.be.a.boolean();
        expect(config.common).to.equals(true);
    });
github kirjs / react-highcharts / test / unit / nonbundleSpec.js View on Github external
beforeEach(()=>{
      fakeHighcharts = {};
        console.log(modulename);
      mock(modulename, fakeHighcharts);
      Component = mock.reRequire('../../' + libPath);
    });
github academia-de-codigo / noire-server / test / plugins / mailer.js View on Github external
before(() => {
        Config = require('config');
        mailConfig = Config.mail;
        smtpConfig = Config.smtp;

        Mock('plugins/logger', Logger);
        Mailer = Mock.reRequire('plugins/mailer');
    });
github blackbaud / skyux-builder / test / cli-utils-prepare-library-package.spec.js View on Github external
beforeEach(() => {
    mock('../config/sky-pages/sky-pages.config', {
      spaPath: (...segments) => segments.join('/'),
      spaPathTempSrc: () => '',
      spaPathTemp: () => ''
    });
    util = mock.reRequire('../cli/utils/prepare-library-package');
  });
github blackbaud / skyux-builder / test / config-protractor.spec.js View on Github external
beforeEach(() => {
    lib = mock.reRequire('../config/protractor/protractor.conf.js');
    config = lib.config;
  });

mock-require

Simple, intuitive mocking of Node.js modules.

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis