Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to disable sepia for certain tests #14

Open
satazor opened this issue Apr 11, 2016 · 4 comments
Open

Possibility to disable sepia for certain tests #14

satazor opened this issue Apr 11, 2016 · 4 comments

Comments

@satazor
Copy link

satazor commented Apr 11, 2016

I'm developing a complex set of test suites and I want to disable sepia for some of them.
Besides the filter feature, is there any way to accomplish this, e.g.: sepia.disable()/enable()?

Thanks

@satazor
Copy link
Author

satazor commented Apr 12, 2016

After analyzing sepia, it seems there's no such feature. Would you guys be interested in adding it?

@satazor
Copy link
Author

satazor commented May 11, 2016

I've made a workaround:

// tests/util/sepia.js

'use strict';

const http = require('http');
const https = require('https');

const originalRequests = { http: http.request, https: https.request };
const sepia = require('sepia');
const sepiaRequests = { http: http.request, https: https.request };

/**
 * Turns sepia on.
 */
function enable() {
    http.request = sepiaRequests.http;
    https.request = sepiaRequests.https;
}

/**
 * Turns sepia off.
 */
function disable() {
    http.request = originalRequests.http;
    https.request = originalRequests.https;
}

disable();

sepia.enable = enable;
sepia.disable = disable;

module.exports = sepia;

@paulwalker
Copy link

paulwalker commented Aug 5, 2016

Thanks, I needed this as it seems to break supertest requests to my app. I'm not sure if anyone else experienced that and has a better workaround?

@aneilbaboo
Copy link

I had the same issue. This would be a great addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants