Транспортир / машинописный текст - не удается найти имя «allure» в «mocha-allure-reporter» - PullRequest
0 голосов
/ 09 апреля 2020

В основном у меня есть этот вопрос, но в mocha-allure-reporter и машинопись . Я использую транспортир с mocha и решил добавить отчет об очаровании

объект 'allure', использующий mocha-allure, не доступен глобально.

Вот protractor.conf. js

mochaOpts: {
    bail: false,
    ui: 'bdd',
    reporter: 'spec',
    compiler: 'ts:ts-node/register'
}

Вот devDependencies в пакете. json

"devDependencies": {
    "chai": "^4.0.2",
    "mocha": "^6.2.2",
    "allure-commandline": "^2.0.0",
    "mocha-allure-reporter": "^1.4.0",
    "mocha-tags": "^1.0.1"
  }

И зависимости

"dependencies": {
    "@types/mocha": "^7.0.1",
    "@types/node": "^13.7.6",
    "chai": "^4.2.0",
    "mocha-allure-reporter": "^1.4.0",
    "chai-as-promised": "^7.1.1",
    "graphviz": "0.0.9",
    "lodash": "^4.17.15",
    "minimist": "^1.2.0",
    "mocha": "^6.2.2",
    "npm-failsafe": "^0.4.1",
    "protractor": "^5.4.2",
    "rimraf": "^2.7.1",
    "ts-node": "^8.5.4",
    "tslint": "^5.20.1",
    "typescript": "^3.8.2",
    "typescript-logging": "^0.6.4",
    "webdriver-manager": "^12.1.7",
    "yargs": "^13.3.0"
}

Вот файл ts, который не может получить доступ к 'allure' по всему миру:

enter image description here

И когда я пытаюсь добавить declare const allure: any;, enter image description here Примечание: в машинописном тексте, пожалуйста, у меня нет большого фона в javascript

1 Ответ

0 голосов
/ 09 апреля 2020
 require("mocha-allure-reporter");
 declare const allure: any;

 describe("Initial Test", function() {
 it("Add Feature" async function() {
    allure.feature("Sample Feature");
  })
 })
...