gitlab-runner异常处理:Test suite failed to run Could not find source file: '/home/gitlab-runner/builds/x

  • 出错现象:
    本地跑单元测试正常的,经过gitlab-runner调度测试后,出现如下错误:
FAIL tests/registrationOfPerson.test.ts
  ● Test suite failed to run
    Could not find source file: '/home/gitlab-runner/builds/ULXArWG6/0/toolrdteam/IVABOX/src/WBE/tests/CameraConfig.test.ts'.
      at getValidSourceFile (node_modules/typescript/lib/typescript.js:135637:29)
      at Object.getSemanticDiagnostics (node_modules/typescript/lib/typescript.js:135859:36)
      at doTypeChecking (node_modules/ts-jest/dist/compiler/language-service.js:11:35)
      at node_modules/ts-jest/dist/compiler/language-service.js:96:25
          at Array.forEach ()
      at compileFn (node_modules/ts-jest/dist/compiler/language-service.js:94:26)
      at Object.compile (node_modules/ts-jest/dist/compiler/instance.js:90:25)
      at TsJestTransformer.process (node_modules/ts-jest/dist/ts-jest-transformer.js:94:41)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:479:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:569:40)
  • 原因:
    安装的某些依赖自身出现问题

  • 解决方法:
    清除代码仓库中缓存,例如:

cd /home/gitlab-runner/builds/ULXArWG6/0/toolrdteam/IVABOX/src/WBE
npx jest --clearCache

执行成功后输出如下内容
Cleared /tmp/jest_rr

你可能感兴趣的:(gitlab-runner异常处理:Test suite failed to run Could not find source file: '/home/gitlab-runner/builds/x)