How to write Jest transformIgnorePatterns

后端 未结 4 2098
独厮守ぢ
独厮守ぢ 2021-02-19 02:52

I have this excpetion

Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it\'s not p         


        
4条回答
  •  野的像风
    2021-02-19 03:19

    The transformIgnorePatterns means if the test path matches any of the patterns, it will not be transformed.

    Note: DO NOT SPLIT MULTI-LINES.

    The jest will ignore all node_modules via default.

    So you must write like this:

    "transformIgnorePatterns": [
      // all exceptions must be first line
      "/node_modules/(?!@microsoft/sp-core-library|sp-dialog|other_libs_need_transform)"
    ],
    

提交回复
热议问题