Skip to content

Commit 14e1713

Browse files
authored
#7180: Upgrade Cucumber-js to v12 (#7221)
1 parent 7d46e41 commit 14e1713

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+7525
-3066
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- run: cmake --version
3535
- uses: actions/setup-node@v4
3636
with:
37-
node-version: 18
37+
node-version: 20
3838
- run: node --version
3939
- run: npm --version
4040
- name: Prepare environment
@@ -100,7 +100,7 @@ jobs:
100100
- name: Use Node.js
101101
uses: actions/setup-node@v4
102102
with:
103-
node-version: 18
103+
node-version: 20
104104
- name: Enable Node.js cache
105105
uses: actions/cache@v4
106106
with:
@@ -116,7 +116,7 @@ jobs:
116116
run: |
117117
./scripts/check_taginfo.py taginfo.json profiles/car.lua
118118
./scripts/format.sh && ./scripts/error_on_dirty.sh
119-
node ./scripts/validate_changelog.js
119+
node ./scripts/validate_changelog.cjs
120120
npm run docs && ./scripts/error_on_dirty.sh
121121
npm audit --production
122122
@@ -215,7 +215,7 @@ jobs:
215215

216216
- name: clang-18-debug-clang-tidy
217217
continue-on-error: false
218-
node: 18
218+
node: 20
219219
runs-on: ubuntu-24.04
220220
BUILD_TYPE: Debug
221221
CCOMPILER: clang-18
@@ -227,7 +227,7 @@ jobs:
227227

228228
- name: clang-17-release
229229
continue-on-error: false
230-
node: 18
230+
node: 20
231231
runs-on: ubuntu-24.04
232232
BUILD_TYPE: Release
233233
CCOMPILER: clang-17
@@ -237,7 +237,7 @@ jobs:
237237

238238
- name: clang-16-release
239239
continue-on-error: false
240-
node: 18
240+
node: 20
241241
runs-on: ubuntu-24.04
242242
BUILD_TYPE: Release
243243
CCOMPILER: clang-16
@@ -247,7 +247,7 @@ jobs:
247247

248248
- name: conan-linux-debug-asan-ubsan
249249
continue-on-error: false
250-
node: 18
250+
node: 20
251251
runs-on: ubuntu-24.04
252252
BUILD_TYPE: Release
253253
CCOMPILER: clang-18
@@ -258,7 +258,7 @@ jobs:
258258

259259
- name: conan-linux-release
260260
continue-on-error: false
261-
node: 18
261+
node: 20
262262
runs-on: ubuntu-24.04
263263
BUILD_TYPE: Release
264264
CCOMPILER: clang-18
@@ -542,12 +542,12 @@ jobs:
542542
popd
543543
npm test
544544
545-
- name: Use Node 18
545+
- name: Use Node 20
546546
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
547547
uses: actions/setup-node@v4
548548
with:
549-
node-version: 18
550-
- name: Run Node package tests on Node 18
549+
node-version: 20
550+
- name: Run Node package tests on Node 20
551551
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
552552
run: |
553553
node --version

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 2,
3+
"singleQuote": true,
4+
"semi": true,
5+
"endOfLine": "lf"
6+
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22
- Changes from 6.0.0
33
- Misc:
4+
- CHANGED: Upgrade Cucumber-js to v12 [#7221](https://github.com/Project-OSRM/osrm-backend/pull/7221)
45
- FIXED: Minor misspellings found in source code, comments and documents [#7215](https://github.com/Project-OSRM/osrm-backend/pull/7215)
56

67
# 6.0.0

cucumber.js

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

cucumber.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Default profile
2+
export default {
3+
strict: true,
4+
tags: 'not @stress and not @todo and not @mld',
5+
import: ['features/support', 'features/step_definitions'],
6+
};
7+
8+
// Additional profiles
9+
export const ch = {
10+
strict: true,
11+
tags: 'not @stress and not @todo and not @mld',
12+
format: ['progress'],
13+
import: ['features/support', 'features/step_definitions'],
14+
};
15+
16+
export const todo = {
17+
strict: true,
18+
tags: '@todo',
19+
import: ['features/support', 'features/step_definitions'],
20+
};
21+
22+
export const all = {
23+
strict: true,
24+
import: ['features/support', 'features/step_definitions'],
25+
};
26+
27+
export const mld = {
28+
strict: true,
29+
tags: 'not @stress and not @todo and not @ch',
30+
format: ['progress'],
31+
import: ['features/support', 'features/step_definitions'],
32+
};

eslint.config.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
const { Linter } = require("eslint");
1+
import { Linter } from 'eslint';
22

33
/** @type {Linter.Config} */
44
const config = [
5-
{
6-
rules: {
7-
indent: ["error", 2],
8-
quotes: ["warn", "single"],
9-
"linebreak-style": ["error", "unix"],
10-
semi: ["error", "always"],
11-
"no-console": ["warn"]
12-
},
13-
languageOptions: {
14-
globals: {
15-
es6: true,
16-
node: true
17-
}
18-
},
19-
ignores: [
20-
"node_modules/",
21-
"build/",
22-
"dist/",
23-
"coverage/"
24-
]
25-
}
5+
{
6+
rules: {
7+
indent: ['error', 2],
8+
quotes: ['warn', 'single'],
9+
'linebreak-style': ['error', 'unix'],
10+
semi: ['error', 'always'],
11+
'no-console': ['warn'],
12+
},
13+
languageOptions: {
14+
globals: {
15+
es6: true,
16+
node: true,
17+
},
18+
},
19+
ignores: ['node_modules/', 'build/', 'dist/', 'coverage/'],
20+
},
2621
];
2722

28-
module.exports = config;
23+
export default config;

features/lib/hash.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
'use strict';
1+
// File content hashing utilities for cache invalidation and content verification
2+
import fs from 'fs';
3+
import crypto from 'crypto';
4+
import d3 from 'd3-queue';
25

3-
const fs = require('fs');
4-
const crypto = require('crypto');
5-
const d3 = require('d3-queue');
6-
7-
module.exports = {
8-
hashOfFiles: (paths, cb) => {
9-
let queue = d3.queue();
10-
for (let i = 0; i < paths.length; ++i) {
11-
queue.defer(fs.readFile, paths[i]);
12-
}
13-
queue.awaitAll((err, results) => {
14-
if (err) return cb(err);
15-
let checksum = crypto.createHash('md5');
16-
for (let i = 0; i < results.length; ++i) {
17-
checksum.update(results[i]);
18-
}
19-
cb(null, checksum.digest('hex'));
20-
});
21-
},
22-
23-
hashOfFile: (path, additional_content, cb) => {
24-
fs.readFile(path, (err, result) => {
25-
if (err) return cb(err);
26-
let checksum = crypto.createHash('md5');
27-
checksum.update(result + (additional_content || "") );
28-
cb(null, checksum.digest('hex'));
29-
});
6+
// Computes MD5 hash of multiple files concatenated together
7+
const hashOfFiles = (paths, cb) => {
8+
let queue = d3.queue();
9+
for (let i = 0; i < paths.length; ++i) {
10+
queue.defer(fs.readFile, paths[i]);
11+
}
12+
queue.awaitAll((err, results) => {
13+
if (err) return cb(err);
14+
let checksum = crypto.createHash('md5');
15+
for (let i = 0; i < results.length; ++i) {
16+
checksum.update(results[i]);
3017
}
18+
cb(null, checksum.digest('hex'));
19+
});
3120
};
21+
22+
// Computes MD5 hash of single file with optional additional content
23+
const hashOfFile = (path, additional_content, cb) => {
24+
fs.readFile(path, (err, result) => {
25+
if (err) return cb(err);
26+
let checksum = crypto.createHash('md5');
27+
checksum.update(result + (additional_content || ''));
28+
cb(null, checksum.digest('hex'));
29+
});
30+
};
31+
32+
export { hashOfFiles, hashOfFile };

features/lib/osm.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
'use strict';
2-
3-
const builder = require('xmlbuilder');
4-
const ensureDecimal = require('./utils').ensureDecimal;
1+
// OpenStreetMap data structures and XML generation utilities for synthetic test data
2+
import builder from 'xmlbuilder';
3+
import { ensureDecimal } from './utils.js';
54

5+
// OpenStreetMap database for storing nodes, ways, and relations
66
class DB {
77
constructor () {
88
this.nodes = new Array();
99
this.ways = new Array();
1010
this.relations = new Array();
1111
}
1212

13+
// Adds OSM node to database
1314
addNode (node) {
1415
this.nodes.push(node);
1516
}
1617

18+
// Adds OSM way to database
1719
addWay (way) {
1820
this.ways.push(way);
1921
}
@@ -28,13 +30,14 @@ class DB {
2830
this.relations = [];
2931
}
3032

33+
// Converts database to OSM XML format for OSRM processing
3134
toXML (callback) {
32-
var xml = builder.create('osm', {'encoding':'UTF-8'});
35+
const xml = builder.create('osm', {'encoding':'UTF-8'});
3336
xml.att('generator', 'osrm-test')
3437
.att('version', '0.6');
3538

3639
this.nodes.forEach((n) => {
37-
var node = xml.ele('node', {
40+
const node = xml.ele('node', {
3841
id: n.id,
3942
version: 1,
4043
uid: n.OSM_UID,
@@ -44,15 +47,15 @@ class DB {
4447
lat: ensureDecimal(n.lat)
4548
});
4649

47-
for (var k in n.tags) {
50+
for (const k in n.tags) {
4851
node.ele('tag')
4952
.att('k', k)
5053
.att('v', n.tags[k]);
5154
}
5255
});
5356

5457
this.ways.forEach((w) => {
55-
var way = xml.ele('way', {
58+
const way = xml.ele('way', {
5659
id: w.id,
5760
version: 1,
5861
uid: w.OSM_UID,
@@ -70,31 +73,31 @@ class DB {
7073
}
7174
});
7275

73-
for (var k in w.tags) {
76+
for (const k in w.tags) {
7477
way.ele('tag')
7578
.att('k', k)
7679
.att('v', w.tags[k]);
7780
}
7881
});
7982

8083
this.relations.forEach((r) => {
81-
var relation = xml.ele('relation', {
84+
const relation = xml.ele('relation', {
8285
id: r.id,
8386
user: r.OSM_USER,
8487
timestamp: r.OSM_TIMESTAMP,
8588
uid: r.OSM_UID
8689
});
8790

8891
r.members.forEach((m) => {
89-
var d = {
92+
const d = {
9093
type: m.type,
9194
ref: m.id
9295
};
9396
if (m.role) d.role = m.role;
9497
relation.ele('member', d);
9598
});
9699

97-
for (var k in r.tags) {
100+
for (const k in r.tags) {
98101
relation.ele('tag')
99102
.att('k', k)
100103
.att('v', r.tags[k]);
@@ -164,9 +167,4 @@ class Relation {
164167
}
165168
}
166169

167-
module.exports = {
168-
DB: DB,
169-
Node: Node,
170-
Way: Way,
171-
Relation: Relation
172-
};
170+
export { DB, Node, Way, Relation };

0 commit comments

Comments
 (0)