rsm-hcd / AndcultureCode.Cli

and-cli command-line tool to manage the development of software applications
https://andculture.com
Apache License 2.0
14 stars 15 forks source link

Investigate upgrading ts-jest and jest #217

Open brandongregoryscott opened 2 years ago

brandongregoryscott commented 2 years ago

Following the upgrade to Node v14 (#162), investigate upgrading to the latest ts-jest and jest versions. I ran into some failing tests that will need to be ironed out:

●  process.exit called with "1"

      128 |
      129 |         Echo.error("Unable to find dotnet data project file");
    > 130 |         shell.exit(1);
          |               ^
      131 |     },
      132 |
      133 |     /**

      at Object.dataProjectFilePathOrExit (src/modules/dotnet-path.ts:130:15)
      at src/modules/dotnet-path.test.ts:248:28
 FAIL  src/modules/dotnet-path.test.ts
  ● Test suite failed to run

    Jest worker encountered 4 child process exceptions, exceeding retry limit

      at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)

-----------------------------------------|---------|----------|---------|---------|------------------------------------------------------
File                                     | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                    
-----------------------------------------|---------|----------|---------|---------|------------------------------------------------------
All files                                |   73.65 |       61 |   62.74 |   74.43 |                                                      
 constants                               |     100 |      100 |     100 |     100 |                                                      
  options.ts                             |     100 |      100 |     100 |     100 |                                                      
 modules                                 |   68.38 |    57.43 |    56.7 |   69.44 |                                                      
  azcopy-sync.ts                         |     100 |      100 |     100 |     100 |                                                      
  command-definitions.ts                 |     100 |      100 |     100 |     100 |                                                      
  constants.ts                           |     100 |      100 |     100 |     100 |                                                      
  dir.ts                                 |     100 |      100 |     100 |     100 |                                                      
  dotnet-build.ts                        |    96.3 |    91.67 |      75 |      96 | 24                                                   
  dotnet-clean.ts                        |   95.74 |      100 |   71.43 |   95.56 | 33-36                                                
  dotnet-cli.ts                          |   93.75 |    78.57 |      50 |   93.33 | 22-31                                                
  dotnet-kill.ts                         |    93.1 |      100 |      60 |   92.59 | 18-21                                                
  dotnet-path.ts                         |   61.63 |       50 |   69.23 |   61.25 | 80,88,93,106-142,188-189,200,217-220,229,250-263     
  dotnet-publish.ts                      |   34.09 |        0 |   16.67 |   34.09 | 28-40,52-64,75-86,90-106                             
  dotnet-restore.ts                      |    91.3 |      100 |      50 |   90.48 | 30-33                                                
  dotnet-test.ts                         |      50 |    28.13 |   35.29 |   49.59 | ...9-122,143,152-157,168-178,184-287,313-314,336-340 
  dotnet.ts                              |   84.31 |       50 |   57.14 |   83.67 | 43-51,90-94                                          
  echo.ts                                |   17.54 |        0 |       0 |   19.61 | 32-96,109-119                                        
  file.ts                                |    61.9 |    16.67 |      75 |    61.9 | 22-32,41-42                                          
  formatters.ts                          |      70 |        0 |   42.86 |   86.67 | 24,26                                                
  frontend-path.ts                       |      60 |      100 |       0 |      60 | 12-19                                                
  git.ts                                 |   79.17 |    81.82 |   66.67 |   78.72 | 36-44,107,121-139                                    
  github.ts                              |   70.33 |    67.86 |   81.13 |   70.51 | ...8,576-579,630,649-653,695,756,761,776-777,827-829 
  jenkins.ts                             |    92.5 |     87.5 |     100 |    92.5 | 56,63,78                                             
  js.ts                                  |      90 |       85 |   66.67 |      92 | 26,71                                                
  node-ci.ts                             |   31.82 |        0 |       0 |      35 | 12-38                                                
  node-clean.ts                          |   46.67 |        0 |       0 |   46.67 | 21-39                                                
  node-restore.ts                        |      40 |        0 |       0 |   44.44 | 22-46                                                
  nuget-upgrade.ts                       |   66.67 |    77.78 |      50 |   73.68 | 36,73-94,117-131                                     
  package-config.ts                      |     100 |      100 |     100 |     100 |                                                      
  prompt.ts                              |   47.37 |    35.71 |   42.86 |   54.84 | 52-84                                                
  ps.ts                                  |     100 |       80 |     100 |     100 | 45                                                   
  variables.ts                           |     100 |      100 |     100 |     100 |                                                      
  webpack-publish.ts                     |   48.89 |    66.67 |      20 |   51.16 | 27-33,55-87                                          
 tests                                   |    94.2 |    65.15 |   88.57 |   93.65 |                                                      
  shared-specs.ts                        |   95.74 |     62.5 |   91.67 |   95.12 | 57,126                                               
  test-utils.ts                          |   93.41 |       66 |   86.96 |   92.94 | 129,143-159,225,291                                  
 tests/factories                         |     100 |      100 |   41.67 |     100 |                                                      
  clone-issue-destination-dto-factory.ts |     100 |      100 |     100 |     100 |                                                      
  clone-issue-source-dto-factory.ts      |     100 |      100 |     100 |     100 |                                                      
  command-definition-factory.ts          |     100 |      100 |     100 |     100 |                                                      
  create-issue-dto-factory.ts            |     100 |      100 |     100 |     100 |                                                      
  factory-type.ts                        |     100 |      100 |     100 |     100 |                                                      
  index.ts                               |     100 |      100 |       0 |     100 |                                                      
  issue-factory.ts                       |     100 |      100 |     100 |     100 |                                                      
  repository-factory.ts                  |     100 |      100 |     100 |     100 |                                                      
  webpack-restore-options-factory.ts     |     100 |      100 |     100 |     100 |                                                      
 utilities                               |   87.92 |    82.86 |   79.07 |   88.41 |                                                      
  command-definition-utils.ts            |   88.89 |      100 |   81.82 |   88.89 | 76,100                                               
  command-string-builder.ts              |   85.37 |       70 |      80 |   88.24 | 48-49,53-54                                          
  command-utils.ts                       |      80 |       90 |      70 |   79.31 | 93-107                                               
  option-string-builder.ts               |   93.33 |    86.11 |   83.33 |   92.98 | 57-58,62-63                                          
-----------------------------------------|---------|----------|---------|---------|------------------------------------------------------
Summary of all failing tests
 FAIL  src/modules/command-registry.test.ts
  ● Test suite failed to run

    TypeError: Converting circular structure to JSON
        --> starting at object with constructor 'Array'
        |     index 0 -> object with constructor 'Command'
        |     property 'parent' -> object with constructor 'Command'
        --- property 'commands' closes the circle
        at stringify (<anonymous>)

      at messageParent (node_modules/jest-worker/build/workers/messageParent.js:42:19)

 FAIL  src/modules/dotnet-path.test.ts
  ● Test suite failed to run

    Jest worker encountered 4 child process exceptions, exceeding retry limit

      at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
brandongregoryscott commented 2 years ago

After some initial poking around, I think dotnet-path.test.ts and command-registry.test.ts are failing due to some changes in Jest v27 in isolateModules: https://github.com/facebook/jest/releases/tag/v27.0.0