Skip to content

Proxyquiring a file that proxyquires a file does not work as expected #67

@dash-

Description

@dash-

My attempt to create a testing fixture to simplify testing has failed, because the fixture would need to use proxyquire, and the fixture would need to be proxyquired into the test. This does not appear to work.

For example, the following will fail:

a.js

const b = require('b');
module.exports = {b};

b.js

module.exports = 'failed';

a.fixture.js

const proxyquire = require('proxyquire');
module.exports = proxyquire('./a', {b: 'success'});

a.test.js

const expect = require('expect');
const proxyquire = require('proxyquire');
const a = proxyquire('./a.fixture', {});
describe('test', () => { it('should succeed', done => {
  expect(a).to.be.equal('success');
  done();
})});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions