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

Wallaby not working with jasmine callFake #1597

Closed
joilson-cisne opened this issue Apr 1, 2018 · 3 comments
Closed

Wallaby not working with jasmine callFake #1597

joilson-cisne opened this issue Apr 1, 2018 · 3 comments
Labels

Comments

@joilson-cisne
Copy link

Issue description or question

Wallaby seems not to be working with jasmine callFake. The argument of the "fake" function is always undefined.

The test below passes when I run with jasmine directly, but it breaks when running with wallaby. Does anyone had this problem before?

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);
    });

Wallaby.js configuration file

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 */) => {
    },
  };
};

Code editor or IDE name and version

Visual Studio Code v1.21.1

OS name and version

OSX 10.13.3

@joilson-cisne joilson-cisne changed the title Wallaby not working with jasmine callFake Wallaby not working with jasmine callFake Apr 1, 2018
@ArtemGovorov
Copy link
Member

Thanks for the report. Apparently you are using Jasmine 2.9, because your code is working as expected in Jasmine 3.x. The bug in Jasmine 2.x support was introduced recently when adding Jasmine 3 support in wallaby.

The regression is fixed and the fix had juts been published in the latest core (or update your Jasmine version to 3.x).

@joilson-cisne
Copy link
Author

Thanks for the quick response. @ArtemGovorov

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

No branches or pull requests

2 participants