8000 chore: update cucumber dependency and remove prettier (#453) · jasonjlock/sdk-javascript@320354f · GitHub
[go: up one dir, main page]

Skip to content

Commit 320354f

Browse files
authored
chore: update cucumber dependency and remove prettier (cloudevents#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>
1 parent d4cb42f commit 320354f

File tree

9 files changed

+6582
-16646
lines changed

9 files changed

+6582
-16646
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"sourceType": "module"
66
},
77
"extends": [
8-
"plugin:prettier/recommended",
98
"plugin:@typescript-eslint/recommended"
109
],
1110
"env": {

.prettierrc.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

cucumber.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
let common = [
88
"--require-module ts-node/register", // Load TypeScript module
99
"--require test/conformance/steps.ts", // Load step definitions
10-
"--format progress-bar", // Load custom formatter
11-
"--format node_modules/cucumber-pretty", // Load custom formatter
1210
].join(" ");
1311

1412
module.exports = {

package-lock.json

Lines changed: 6570 additions & 16623 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"uuid": "~8.3.0"
111111
},
112112
"devDependencies": {
113+
"@cucumber/cucumber": "^8.0.0-rc.1",
113114
"@types/ajv": "^1.0.0",
114115
"@types/chai": "^4.2.11",
115116
"@types/cucumber": "^6.0.1",
@@ -122,16 +123,11 @@
122123
"@typescript-eslint/parser": "^4.29.0",
123124
"axios": "< 8000 /span>^0.21.3",
124125
"chai": "~4.2.0",
125-
"cucumber": "^6.0.5",
126-
"cucumber-pretty": "^6.0.0",
127-
"cucumber-tsflow": "^3.2.0",
128126
"eslint": "^7.32.0",
129-
"eslint-config-prettier": "^8.3.0",
130127
"eslint-config-standard": "^16.0.3",
131128
"eslint-plugin-header": "^3.1.1",
132129
"eslint-plugin-import": "^2.23.4",
133130
"eslint-plugin-node": "^11.1.0",
134-
"eslint-plugin-prettier": "^3.4.0",
135131
"eslint-plugin-promise": "^5.1.0",
136132
"got": "^11.7.0",
137133
"http-parser-js": "^0.5.2",

src/event/cloudevent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
import { ErrorObject } from "ajv";
67
import { v4 as uuidv4 } from "uuid";
78
import { Emitter } from "..";
89

@@ -166,7 +167,7 @@ See: https://github.com/cloudevents/spec/blob/v1.0/spec.md#type-system`);
166167
if (e instanceof ValidationError) {
167168
throw e;
168169
} else {
169-
throw new ValidationError("invalid payload", e);
170+
throw new ValidationError("invalid payload", [e] as ErrorObject[]);
170171
}
171172
}
172173
}

test/conformance/steps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* eslint-disable @typescript-eslint/ban-ts-comment */
77

88
import { assert } from "chai";
9-
import { Given, When, Then, World } from "cucumber";
9+
import { Given, When, Then, World } from "@cucumber/cucumber";
1010
import { Message, Headers, HTTP } from "../../src";
1111

1212
// eslint-disable-next-line @typescript-eslint/no-var-requires

test/integration/cloud_event_test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import fs from "fs";
99
import { expect } from "chai";
1010
import { CloudEvent, ValidationError, Version } from "../../src";
1111
import { asBase64 } from "../../src/event/validation";
12+
import { ErrorObject } from "schema-utils/declarations/validate";
1213

1314
const type = "org.cncf.cloudevents.example";
1415
const source = "http://unit.test";
@@ -203,7 +204,7 @@ describe("A 1.0 CloudEvent", () => {
203204
});
204205
} catch (err) {
205206
expect(err).to.be.instanceOf(TypeError);
206-
expect(err.message).to.include("invalid payload");
207+
expect((err as TypeError).message).to.include("invalid payload");
207208
}
208209
});
209210

@@ -225,10 +226,12 @@ describe("A 1.0 CloudEvent", () => {
225226
source: "",
226227
});
227228
} catch (err) {
228-
expect(err).to.be.instanceOf(TypeError);
229-
expect(err.message).to.include("invalid payload");
230-
expect(err.errors[0].dataPath).to.equal(".source");
231-
expect(err.errors[0].keyword).to.equal("minLength");
229+
expect(err).to.be.instanceOf(ValidationError);
230+
const e = err as unknown as ValidationError;
231+
const errors = e.errors as ErrorObject[];
232+
expect(e.message).to.include("invalid payload");
233+
expect(errors[0].dataPath).to.equal(".source");
234+
expect(errors[0].keyword).to.equal("minLength");
232235
}
233236
});
234237
});

test/integration/parser_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ describe("JSON Event Format Parser", () => {
6969

7070
it("Must accept when the payload is a string well formed as JSON", () => {
7171
// setup
72-
// eslint-disable-next-line prettier/prettier
7372
const payload = "{\"much\" : \"wow\"}";
7473
const parser = new Parser();
7574

0 commit comments

Comments
 (0)
0