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

Test fails due to upstream pretty-format package #1626

Closed
TrevorBurnham opened this issue Apr 21, 2018 · 2 comments
Closed

Test fails due to upstream pretty-format package #1626

TrevorBurnham opened this issue Apr 21, 2018 · 2 comments

Comments

@TrevorBurnham
Copy link

TrevorBurnham commented Apr 21, 2018

Issue description or question

This one was a puzzler for me. I hit the same error mentioned in this comment by @nathanvale:

TypeError: Cannot read property 'test' of undefined
  
  at findPlugin (../../node_modules/pretty-format/build/index.js:272:20)
      at Array.map (<anonymous>)
  at Object.<anonymous> (../../../../.vscode/extensions/WallabyJs.wallaby-vscode-1.0.83/projects/cc362621f18cef70/instrumented/src/Form/__tests__/Form.js:25:35)
  at Object.e.length.arguments.(anonymous function) (../../../../.vscode/extensions/WallabyJs.wallaby-vscode-1.0.83/projects/cc362621f18cef70/instrumented/config/jest/setupTests.js:28:1786)

I tried to replicate in a new project but couldn't. Then I tried simply copying and pasting the project to a new directory—and still couldn't! Then I found that if I deleted node_modules/ in a parent directory, the error went away and all tests passed. I isolated the source of the problem to one particular dependency, lint-staged@6.1.1, which in turn brings in pretty-format@21.2.1.

I've created a complete test repo. Steps to reproduce the bug in that repo:

  1. yarn install
  2. cd subproject && yarn install
  3. Open in VS Code and run Wallaby

Note that the bug occurs whether you have the whole repo or just the subproject/ dir open in your editor.

Wallaby.js configuration file

module.exports = function(wallaby) {
  return {
    testFramework: 'jest',

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

    files: [
      'subproject/src/**/*.js',
      'subproject/src/**/*.snap',
      'subproject/jest.config.js',
      'subproject/config/jest/setupTests.js',
      '!subproject/src/**/__tests__/*.js',
    ],

    tests: ['subproject/src/**/__tests__/*.js'],

    compilers: {
      '**/*.js': wallaby.compilers.babel(),
    },

    setup(wallaby) {
      const jestConfig = require(`./subproject/jest.config.js`);
      wallaby.testFramework.configure(jestConfig);
    },
  };
};

Code editor or IDE name and version

Visual Studio Code v1.22.2

OS name and version

macOS 10.13.4

@ArtemGovorov
Copy link
Member

Thanks for sharing the sample repo. The issue is fixed and the fix is published in the latest core version.

@TrevorBurnham
Copy link
Author

Fix confirmed, thank you! /cc @nathanvale

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

No branches or pull requests

2 participants