Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors and warnings #100

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rules:
valid-jsdoc: off
no-multi-spaces: error
no-return-await: error
no-redeclare: [error, { "builtinGlobals": true }]
require-await: warn
no-self-compare: error
no-useless-concat: error
Expand All @@ -35,7 +36,7 @@ rules:
arrow-spacing: error
no-confusing-arrow: error
no-var: error
object-shorthand: [warn, consistent-as-needed]
object-shorthand: [off, consistent-as-needed]
prefer-const: error
prefer-destructuring: warn
prefer-rest-params: warn
Expand Down
3 changes: 3 additions & 0 deletions packages/allure-cucumberjs/features/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules:
new-cap: off

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { StepResult } from "allure-js-commons";
chai.use(ChaiPartial);

Then(/^it has result for "(.*)"$/, function(name: string) {
expect(this.allureReport.testResults).to.partial([{name}]);
expect(this.allureReport.testResults).to.partial([{ name }]);
});

When(/^I choose result for "(.*)"$/, function(name: string) {
Expand Down
7 changes: 2 additions & 5 deletions packages/allure-cucumberjs/features/support/report.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { CucumberJSAllureFormatter } from "../../src/CucumberJSAllureReporter";
import {AllureRuntime} from "allure-js-commons";
import { AllureRuntime } from "allure-js-commons";

export default class Reporter extends CucumberJSAllureFormatter {
constructor(options: any) {
super(
options,
new AllureRuntime({ resultsDir: "./out/allure-results" }), {}
);
super(options, new AllureRuntime({ resultsDir: "./out/allure-results" }), {});
}
}
11 changes: 2 additions & 9 deletions packages/allure-cucumberjs/features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,17 @@ const getAllureReport: (reportPath: string) => AllureReport = reportPath => {
return allureReport;
};


class AllureWorld implements World, AllureWorld {
tmpDir: string = "";
formatterPath = "support/allure-formatter.ts";
formatterOutPath = "../out/allure-results";
allureReport: AllureReport = { testResults: [] };
result: {stdout: string, stderr: string, error: string} = {stdout: "", stderr: "", error: ""}
result: { stdout: string; stderr: string; error: string } = { stdout: "", stderr: "", error: "" };

async run() {
const formatterPath = path.join(this.tmpDir, this.formatterPath);
const formatterOutPath = path.join(this.tmpDir, this.formatterOutPath);
const argv = [
"",
"",
"--backtrace",
"--require-module=ts-node/register",
`--format=${formatterPath}:.dummy.txt`
];
const argv = ["", "", "--backtrace", "--require-module=ts-node/register", `--format=${formatterPath}:.dummy.txt`];

const cwd = this.tmpDir;

Expand Down
4 changes: 2 additions & 2 deletions packages/allure-cucumberjs/src/CucumberJSAllureReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class CucumberJSAllureFormatter extends Formatter {
if (test.example !== undefined) {
info.a = test.example.arguments;
for (const prop in test.example.arguments) {
if (!test.example.arguments.hasOwnProperty(prop)) continue;
if (!test.example.arguments[prop]) continue;
this.currentTest.addParameter(prop, test.example.arguments[prop]);
}
}
Expand All @@ -169,7 +169,7 @@ export class CucumberJSAllureFormatter extends Formatter {
this.currentTest.addLabel(LabelName.TAG, tag.name);

for (const label in this.labels) {
if (!this.labels.hasOwnProperty(label)) continue;
if (!this.labels[label]) continue;
for (const reg of this.labels[label]) {
const match = tag.name.match(reg);
if (match != null && match.length > 1) {
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-cucumberjs/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function hash(data: string): string {
export function applyExample(text: string, example: Example | undefined): string {
if (example === undefined) return text;
for (const argName in example.arguments) {
if (!example.arguments.hasOwnProperty(argName)) continue;
if (!example.arguments[argName]) continue;
text = text.replace(new RegExp(`<${argName}>`, "g"), `<${example.arguments[argName]}>`);
}
return text;
Expand Down
4 changes: 3 additions & 1 deletion packages/allure-jasmine/test/matchers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import MatchersUtil = jasmine.MatchersUtil;
import CustomEqualityTester = jasmine.CustomEqualityTester;
import CustomMatcher = jasmine.CustomMatcher;

declare global {
// eslint-disable-next-line no-redeclare
namespace jasmine {
interface Matchers<T> {
toHaveTestLike(expected: any, expectationFailOutput?: any): boolean;
Expand Down Expand Up @@ -37,7 +39,7 @@ const compare: (actual: any, expected: any) => boolean = (actual, expected) => {
};

export const matchers = {
toHaveTestLike: (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]) => ({
toHaveTestLike: (util: MatchersUtil, customEqualityTesters: Readonly<CustomEqualityTester[]>) => ({
compare: (actual: any, expected: any) => ({
pass: compare(actual, { tests: [expected] }),
message:
Expand Down
2 changes: 1 addition & 1 deletion packages/allure-jasmine/test/status.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Status } from "allure-js-commons";
import { matchers } from "./matchers";
import {runTest} from "./helpers";
import { runTest } from "./helpers";

describe("Allure Result", () => {
beforeAll(() => jasmine.addMatchers(matchers));
Expand Down