chore: update cucumber dependency and remove prettier (#453)

The combination of prettier and eslint was causing some conflicting error
messages in formatting between VSCode and using npm in the CLI. For the most
part, there were only a couple of required formatting changes that prettier
was covering, so the change is minor.

The cucumber dependency had a major version bump and was carrying some unsafe
dependencies in the older version. This commit bumps to the new version and
makes appropriate configuration changes.

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2021-12-22 10:45:35 -05:00 committed by GitHub
parent d4cb42f94b
commit 320354f750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3627 additions and 13691 deletions

View File

@ -5,7 +5,6 @@
"sourceType": "module"
},
"extends": [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {

View File

@ -1,7 +0,0 @@
module.exports = {
semi: true,
trailingComma: "all",
doubleQuote: true,
printWidth: 120,
tabWidth: 2
}

View File

@ -7,8 +7,6 @@
let common = [
"--require-module ts-node/register", // Load TypeScript module
"--require test/conformance/steps.ts", // Load step definitions
"--format progress-bar", // Load custom formatter
"--format node_modules/cucumber-pretty", // Load custom formatter
].join(" ");
module.exports = {

17261
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,7 @@
"uuid": "~8.3.0"
},
"devDependencies": {
"@cucumber/cucumber": "^8.0.0-rc.1",
"@types/ajv": "^1.0.0",
"@types/chai": "^4.2.11",
"@types/cucumber": "^6.0.1",
@ -122,16 +123,11 @@
"@typescript-eslint/parser": "^4.29.0",
"axios": "^0.21.3",
"chai": "~4.2.0",
"cucumber": "^6.0.5",
"cucumber-pretty": "^6.0.0",
"cucumber-tsflow": "^3.2.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"got": "^11.7.0",
"http-parser-js": "^0.5.2",

View File

@ -3,6 +3,7 @@
SPDX-License-Identifier: Apache-2.0
*/
import { ErrorObject } from "ajv";
import { v4 as uuidv4 } from "uuid";
import { Emitter } from "..";
@ -166,7 +167,7 @@ See: https://github.com/cloudevents/spec/blob/v1.0/spec.md#type-system`);
if (e instanceof ValidationError) {
throw e;
} else {
throw new ValidationError("invalid payload", e);
throw new ValidationError("invalid payload", [e] as ErrorObject[]);
}
}
}

View File

@ -6,7 +6,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { assert } from "chai";
import { Given, When, Then, World } from "cucumber";
import { Given, When, Then, World } from "@cucumber/cucumber";
import { Message, Headers, HTTP } from "../../src";
// eslint-disable-next-line @typescript-eslint/no-var-requires

View File

@ -9,6 +9,7 @@ import fs from "fs";
import { expect } from "chai";
import { CloudEvent, ValidationError, Version } from "../../src";
import { asBase64 } from "../../src/event/validation";
import { ErrorObject } from "schema-utils/declarations/validate";
const type = "org.cncf.cloudevents.example";
const source = "http://unit.test";
@ -203,7 +204,7 @@ describe("A 1.0 CloudEvent", () => {
});
} catch (err) {
expect(err).to.be.instanceOf(TypeError);
expect(err.message).to.include("invalid payload");
expect((err as TypeError).message).to.include("invalid payload");
}
});
@ -225,10 +226,12 @@ describe("A 1.0 CloudEvent", () => {
source: "",
});
} catch (err) {
expect(err).to.be.instanceOf(TypeError);
expect(err.message).to.include("invalid payload");
expect(err.errors[0].dataPath).to.equal(".source");
expect(err.errors[0].keyword).to.equal("minLength");
expect(err).to.be.instanceOf(ValidationError);
const e = err as unknown as ValidationError;
const errors = e.errors as ErrorObject[];
expect(e.message).to.include("invalid payload");
expect(errors[0].dataPath).to.equal(".source");
expect(errors[0].keyword).to.equal("minLength");
}
});
});

View File

@ -69,7 +69,6 @@ describe("JSON Event Format Parser", () => {
it("Must accept when the payload is a string well formed as JSON", () => {
// setup
// eslint-disable-next-line prettier/prettier
const payload = "{\"much\" : \"wow\"}";
const parser = new Parser();