1

开玩笑测试失败

测试套件无法运行

TypeError:无法读取未定义的属性“acquire”

在对象。(node_modules/ace-diff/src/index.js:12:35)

在securesincity/react-ace#179,securesincity/react-ace#230 for react-ace 库中看到了类似的问题。Nuking node_modules 没有解决问题。

有没有办法忽略开玩笑的错误?运行应用程序时不会引发错误。

包.json

{
  "name": "app-ui",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "jest": {
    "preset": "jest-preset-angular",
    "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
    "collectCoverage": true
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "6.0.0",
    "@angular/common": "6.0.0",
    "@angular/compiler": "6.0.0",
    "@angular/core": "6.0.0",
    "@angular/forms": "6.0.0",
    "@angular/http": "6.0.0",
    "@angular/platform-browser": "6.0.0",
    "@angular/platform-browser-dynamic": "6.0.0",
    "@angular/router": "6.0.0",
    "@ng-select/ng-select": "^2.3.2",
    "@ngrx/effects": "6.0.0-beta.1",
    "@ngrx/router-store": "6.0.0-beta.1",
    "@ngrx/store": "6.0.0-beta.1",
    "@ngrx/store-devtools": "6.0.0-beta.1",
    "@types/highlight.js": "^9.12.2",
    "@types/mustache": "0.8.30",
    "@types/underscore": "1.8.4",
    "ace-diff": "2.2.0",
    "ang-jsoneditor": "^1.5.12",
    "brace": "0.11.1",
    "core-js": "2.4.1",
    "highlightjs": "^9.10.0",
    "js-yaml": "^3.11.0",
    "jsoneditor": "^5.17.1",
    "mermaid": "8.0.0-rc.8",
    "mustache": "2.3.0",
    "ng2-ace-editor": "0.3.1",
    "ng2-select": "2.0.0",
    "ng2-semantic-ui": "0.9.7",
    "popper.js": "1.12.9",
    "rxjs": "6.1.0",
    "semantic-ui-css": "2.2.12",
    "semver": "^5.5.0",
    "underscore": "1.8.3",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.1",
    "@angular/cli": "^6.0.1",
    "@angular/compiler-cli": "6.0.0",
    "@angular/language-service": "6.0.0",
    "@types/chai": "^4.1.2",
    "@types/jasmine": "2.5.53",
    "@types/jasminewd2": "2.0.2",
    "@types/jest": "^22.2.2",
    "@types/node": "6.0.60",
    "chai": "^4.1.2",
    "codelyzer": "3.2.0",
    "jasmine-core": "2.6.2",
    "jasmine-marbles": "^0.3.1",
    "jasmine-spec-reporter": "4.1.0",
    "jest": "^22.4.3",
    "jest-junit": "^3.6.0",
    "jest-preset-angular": "^5.2.1",
    "karma": "1.7.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "1.2.1",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.1.2",
    "ts-node": "3.2.0",
    "tslint": "5.7.0",
    "typescript": "2.7.2",
    "babel-jest": "23.4.0",
    "babel-core": "6.26.3",
    "babel-preset-env": "1.7.0"
  }
}

开玩笑的配置:

{
  "preset": "jest-preset-angular",
  "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
  "globals": {
    "ts-jest": {
      "tsConfigFile": "src/tsconfig.spec.json",
      "useBabelrc": true
    },
    "__TRANSFORM_HTML__": true
  },
  "transform": {
    "^.+\\.(ts|js|html)$": "<rootDir>/node_modules/jest-preset-angular/preprocessor.js",
    "^.+\\.js$": "babel-jest"
  },
  "transformIgnorePatterns": [
    "node_modules/(?!(ace-diff))"
  ]
}

我无法分享我的源代码,但是我在我的组件中导入 AceDiff,如下所示

import AceDiff from 'ace-diff/src/index.js';

然后将其用作

this.appEditorAceDiffer = new AceDiff({
      element: '.acediff',
      left: {
        content: this.originalYaml,
        editable: false
      },
      right: {
        content: this.SomeYaml,
        copyLinkEnabled: false
      },
    });

请让我知道如何提供更多信息。

4

0 回答 0