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

fix some rewiremock usages #4510

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/node-unit/buffered-worker-pool.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('class BufferedWorkerPool', function() {

serializeJavascript = sinon.spy(require('serialize-javascript'));
BufferedWorkerPool = rewiremock.proxy(
require.resolve('../../lib/nodejs/buffered-worker-pool'),
() => require('../../lib/nodejs/buffered-worker-pool'),
{
workerpool: {
pool: sinon.stub().returns(pool),
Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/cli/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('cli/config', function() {
beforeEach(function() {
findup = {sync: sinon.stub().returns('/some/path/.mocharc.js')};
const config = rewiremock.proxy(
require.resolve('../../../lib/cli/config'),
() => require('../../../lib/cli/config'),
r => ({
'find-up': r.by(() => findup)
})
Expand Down
2 changes: 1 addition & 1 deletion test/node-unit/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('utils', function() {

beforeEach(function() {
// add deps to be mocked as needed to second parameter
utils = rewiremock.proxy('../../lib/utils', {});
utils = rewiremock.proxy(() => require('../../lib/utils'), {});
});

describe('function', function() {
Expand Down
6 changes: 2 additions & 4 deletions test/node-unit/worker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const rewiremock = require('rewiremock/node');
const {SerializableWorkerResult} = require('../../lib/nodejs/serializer');
const sinon = require('sinon');

const WORKER_PATH = require.resolve('../../lib/nodejs/worker.js');

describe('worker', function() {
let worker;
let stubs;
Expand All @@ -24,7 +22,7 @@ describe('worker', function() {
describe('when run as main process', function() {
it('should throw', function() {
expect(() => {
rewiremock.proxy(WORKER_PATH, {
rewiremock.proxy(() => require('../../lib/nodejs/worker.js'), {
workerpool: {
isMainThread: true,
worker: stubs.workerpool.worker
Expand Down Expand Up @@ -62,7 +60,7 @@ describe('worker', function() {
aggregateRootHooks: sinon.stub().resolves()
};

worker = rewiremock.proxy(WORKER_PATH, {
worker = rewiremock.proxy(() => require('../../lib/nodejs/worker.js'), {
workerpool: stubs.workerpool,
'../../lib/mocha': stubs.Mocha,
'../../lib/nodejs/serializer': stubs.serializer,
Expand Down