wallaby.js
seems not to be working with jasmine callFake
. I want to use the arguments passed to the original function inside the the "fake" function. But I always get undefined
with wallaby
.
The test below works when running jasmine
directly, but breaks when running via wallaby
.
Did this happen with anyone else? Any ideas on how to fix it?
it('test callFake and wallaby', async () => {
// Arrange
const myObj = {
myFunc: (a) => a + 1,
};
spyOn(myObj, 'myFunc')
.and.callFake(arg => arg);
// Act
const result = myObj.myFunc(1);
// Assert
expect(result).toBe(1);
});
module.exports = (wallaby) => {
return {
files: [
'src/**/*.js',
'migrations/*',
'test/_helpers/*',
'seeds/*',
'config/*',
{ pattern: '.env', instrument: false },
],
tests: [
'test/**/*.spec.js',
],
compilers: {
'**/*.js': wallaby.compilers.babel(),
},
testFramework: 'jasmine',
env: {
type: 'node',
params: {
env: 'NODE_ENV=test;MONGODB_CONQUERY=mongodb://localhost:27017/athena-test',
},
},
workers: {
initial: 1,
regular: 1,
restart: true,
},
setup: (/* wallaby */) => {
require('dotenv').load({ path: '.env' }); // eslint-disable-line
require('./test/_helpers/dropDatabase'); // eslint-disable-line
},
teardown: (/* wallaby */) => {
},
};
};
Visual Studio Code v1.21.1
OSX 10.13.3
It was a bug in Jasmine 2.x support in wallaby it is fixed now.