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

Cannot read property 'some' of undefined #2371

Labels
🐛 Bug Confirmed Bug is confirmed

Comments

@CatsMiaow
Copy link

  • Node.js v14
  • jest v26.6.3
  • ts-jest v26.5.1
  • typescript v4.1.5
const transformer = require('@nestjs/graphql/plugin');

module.exports = {
  name: 'nestjs-graphql-transformer',
  version: 1,
  factory: (cs) => transformer.before({}, cs.tsCompiler.program)
};
TypeError: Cannot read property 'some' of undefined

       6 |   name: 'nestjs-graphql-transformer',
       7 |   version: 1,
    >  8 |   factory: (cs) => transformer.before({}, cs.tsCompiler.program)
         |                                              ^
       9 | };
      10 | 

      at ConfigSet.isTestFile (../node_modules/ts-jest/dist/config/config-set.js:436:40)
      at ../node_modules/ts-jest/dist/compiler/language-service.js:116:55
          at Array.filter (<anonymous>)
      at Object.exports.initializeLanguageServiceInstance (../node_modules/ts-jest/dist/compiler/language-service.js:116:10)
      at Object.exports.createCompilerInstance (../node_modules/ts-jest/dist/compiler/instance.js:51:30)
      at ConfigSet.get (../node_modules/ts-jest/dist/config/config-set.js:396:31)
      at ConfigSet.<anonymous> (../node_modules/ts-jest/dist/utils/memoize.js:44:24)
      at Object.factory (jest.e2e.transformer.js:8:46)
      at ../node_modules/ts-jest/dist/config/config-set.js:267:61
          at Array.map (<anonymous>)

The error does not occur in the 26.4.4 version, but in the latest version of 26.5.1 it does.

this._setupTsJestCfg(options)
this._resolveTsCacheDir()
this._matchablePatterns = [...this._jestCfg.testMatch, ...this._jestCfg.testRegex].filter(

In _setupTsJestCfg(), astTransformers are processed, after which _matchablePatterns is defined.
Perhaps _matchablePatterns should be defined before that.

v26.4.4 is being processed with different logic.

https://github.com/kulshekhar/ts-jest/blob/v26.4.4/src/config/config-set.ts#L540-L557

@CatsMiaow CatsMiaow added Bug Report Needs Repo Need a minimium repository to reproduce the problem Needs Triage labels Feb 17, 2021
@ahnpnl
Copy link
Collaborator

ahnpnl commented Feb 17, 2021

Moving up LGTM, PR is welcome.

@ahnpnl ahnpnl added 🐛 Bug Confirmed Bug is confirmed and removed Bug Report Needs Repo Need a minimium repository to reproduce the problem Needs Triage labels Feb 17, 2021
@ahnpnl
Copy link
Collaborator

ahnpnl commented Feb 17, 2021

There is a branch 26.5.2, you can check out that branch for making the PR

@ahnpnl
Copy link
Collaborator

ahnpnl commented Feb 18, 2021

Closes via #2373

This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment