20 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
154
views
Fancy moving-nodes network visualization with Python
I have a network that undergoes a loop, and for each iteration its edges update their weight. Some of them increase their weight, strengthening the link between the two nodes, and some of them ...
1
vote
1
answer
202
views
running mocha tests through vsCode throws error 'source not found'
all my tests are running with mocha.js and I can debug them easily, except for one specific test file that causes the error Could not load source 'some path here/fileNameToTest.js': Source not found.
...
2
votes
0
answers
199
views
Jest coverage test does not include 'rewired' files
I am including my non-exported function (let's say A) to the Jest unit tests with the 'rewire' function. When I run the coverage test, the A function is not included to the coverage test. Is there any ...
0
votes
1
answer
301
views
window.location is undefined when using Jest with rewire
I'm writing tests for a file(some-file.js) that calls functions from another file(url-manipulator.js). I'm getting an error regarding window.location being undefined. You can see in the error below ...
1
vote
0
answers
170
views
Rewire : How to access an exported class and a function and test them?
I have a class and a function in one file
export class MainClass{
....
}
export function test_function(){}
Previously, I just had the test_function exported and could easily test it using
rewire('...
2
votes
0
answers
783
views
The following changes are being made to your tsconfig.json file: - compilerOptions.paths must not be set (aliased imports are not supported)
I just cloned a react/typescript template repository and did npm install I should say that the node packages installed in this app is really large number and react rewired is installed too, also the ...
0
votes
1
answer
1k
views
How to force a return value from a mocked non-exported function using sinon or proxyquire or rewire?
I am just getting started unit testing nodejs. I have been using mocha, chai and sinon.
I hit a snag when I wanted to test a function which is not exported. proxyquire looks good, as does rewire.
...
0
votes
1
answer
131
views
How can I test un-exported pre ES6 JS files with karma/jasmine?
I have a plain JS file that is written with pre ES6 JS code that I want to test using a karma/jasmine test suite. The file is large but I just want to get a super simple example working.
// pluginV3....
1
vote
0
answers
446
views
Does Rewire set the current running module variables as well as the specified module variables?
So, I was doing some testing with Rewire with Mocha, and I noticed behavior that seems odd to me. using myModule.__set__() seems to actually set the specified variable in the the specified module (...
4
votes
1
answer
3k
views
Rewire private Typescript class methods
I'm trying to write unit tests for some private methods in my class using Typescript for my Node.js module.
I tried using rewire, but it's unable to access any methods (even public ones).
Here is my ...
4
votes
2
answers
3k
views
babel-plugin-rewire does not work in a Typescript project
Note: My goal it bring Rewire like functionally to the project. Be it using the Rewire package, babel-plugin-rewire or any other library that satisfies my goal. With that in mind, here is the detail:
...
0
votes
1
answer
1k
views
Module variables not clear between tests in Jest
I would like to be able to isolate the side effects that seem to be related when testing two functions that modify the same state variable myVar independently of each other.
example.js
export function ...
2
votes
0
answers
481
views
__Rewire__ is not a function
Using Rewire for testing..
Rewire is failing to rewire, and I'm wondering why.
Here is an example of rewire failing:
A file has a few exported functions...
export function foo() {}
export function bar(...
2
votes
1
answer
552
views
Rewire a private function p0, but says: p0 not defined
The main.js is like this
const p0 = (a, b) => (a+b)
const p1 = (a, b) => {
return p0(a, b) + 10;
}
module.exports = { p1 }
The test code
const rewire = require('rewire');
const myMod = ...
0
votes
1
answer
662
views
Unit testing - mocking a config file referenced in a method
I'm trying to test a method that contains a reference to a global variable containing some configs taken from a json file.
async function methodToTest(var1, var2, var3) {
const functionName = '...