Skip to content

chore: update cucumber dependency and remove prettier #453

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

Merged
merged 1 commit into from
Dec 22, 2021
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
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"sourceType": "module"
},
"extends": [
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {
Expand Down
7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
23,193 changes: 6,570 additions & 16,623 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/event/cloudevent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SPDX-License-Identifier: Apache-2.0
*/

import { ErrorObject } from "ajv";
import { v4 as uuidv4 } from "uuid";
import { Emitter } from "..";

Expand Down Expand Up @@ -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[]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions test/integration/cloud_event_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
}
});

Expand All @@ -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");
}
});
});
1 change: 0 additions & 1 deletion test/integration/parser_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down