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, TypeScript and Jest Mocks #1224

Closed
unstubbable opened this issue Jul 12, 2017 · 2 comments
Closed

Wallaby, TypeScript and Jest Mocks #1224

unstubbable opened this issue Jul 12, 2017 · 2 comments
Labels

Comments

@unstubbable
Copy link

unstubbable commented Jul 12, 2017

Issue description or question

I can not get Jest mocks to work with wallaby. I read #1152 as well as #1181 (comment) but couldn’t find a config that works. This minimal example should help reproducing and hopefully fixing the issue. Here is also a summary of what’s configured there:

Wallaby.js configuration file

module.exports = function() {
  return {
    files: ["tsconfig.json", "src/**/*.ts", "!src/**/*.test.ts"],

    tests: ["src/**/*.test.ts"],

    env: {
      type: "node",
      runner: "node"
    },

    testFramework: "jest"
  };
};

Jest configuration (in package.json)

{
  "jest": {
    "transform": {
      ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ]
  }
}

Code editor or IDE name and version

Visual Studio Code v1.14.0

OS name and version

macOS 10.12.5

@ArtemGovorov
Copy link
Member

Thanks for the repo!
The issue is fixed in the the latest core version and the fix is published. Note that after the update you'll still need the preprocessor configure similar to the issue that you have referenced (#1181 (comment)). I have sent you the pull request with the change.

@unstubbable
Copy link
Author

@ArtemGovorov Thanks a lot for the quick fix!

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