Skip to content

Commit 8b53b48

Browse files
Copilotrubensworks
andauthored
Migrate to jest 30 (#166)
Agent-Logs-Url: https://github.com/LinkedSoftwareDependencies/Components.js/sessions/35e962ab-b185-4419-9cae-11b5fe144fe6 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 58f5ccb commit 8b53b48

14 files changed

Lines changed: 1238 additions & 741 deletions

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"devDependencies": {
5454
"@rubensworks/eslint-config": "1.0.1",
55-
"@types/jest": "^29.0.0",
55+
"@types/jest": "^30.0.0",
5656
"@types/stream-to-array": "^2.3.0",
5757
"@types/streamify-string": "^1.0.0",
5858
"@typescript-eslint/eslint-plugin": "^5.0.0",
@@ -64,8 +64,8 @@
6464
"eslint-plugin-jest": "^26.0.0",
6565
"eslint-plugin-tsdoc": "^0.2.7",
6666
"eslint-plugin-unused-imports": "^2.0.0",
67-
"jest": "^29.0.0",
68-
"jest-mock": "^29.0.0",
67+
"jest": "^30.0.0",
68+
"jest-mock": "^30.0.0",
6969
"jest-rdf": "^2.0.0",
7070
"jshint": "^2.1.10",
7171
"manual-git-changelog": "^1.0.1",

test/integration/instantiateResourceConfigComponent-test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('construction with component configs as Resource', () => {
134134
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
135135
});
136136
await expect(configConstructorPool.instantiate(config, settings)).rejects
137-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
137+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
138138
});
139139

140140
it('instantiated with a config with all parameters with multiple values as list', async() => {
@@ -181,7 +181,7 @@ describe('construction with component configs as Resource', () => {
181181

182182
it('with undefined variables', async() => {
183183
await expect(configConstructorPool.instantiate(config, settings)).rejects
184-
.toThrowError(/^Undefined variable: ex:var1/u);
184+
.toThrow(/^Undefined variable: ex:var1/u);
185185
});
186186

187187
it('with variables that are undefined', async() => {
@@ -190,7 +190,7 @@ describe('construction with component configs as Resource', () => {
190190
'ex:var3': 'C',
191191
};
192192
await expect(configConstructorPool.instantiate(config, settings)).rejects
193-
.toThrowError(/^Undefined variable: ex:var2/u);
193+
.toThrow(/^Undefined variable: ex:var2/u);
194194
});
195195
});
196196
});
@@ -238,7 +238,7 @@ describe('construction with component configs as Resource', () => {
238238
'http://example.org/n3#comments': '"true"',
239239
});
240240
await expect(configConstructorPool.instantiate(config, settings)).rejects
241-
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
241+
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
242242
});
243243

244244
it('instantiated with a config with all parameters as multiple non-list values should throw', async() => {
@@ -250,7 +250,7 @@ describe('construction with component configs as Resource', () => {
250250
'http://example.org/n3#comments': [ '"true"', '"false"' ],
251251
});
252252
await expect(configConstructorPool.instantiate(config, settings)).rejects
253-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
253+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
254254
});
255255

256256
it('instantiated with a config with all parameters as singular values as list', async() => {
@@ -328,7 +328,7 @@ describe('construction with component configs as Resource', () => {
328328
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
329329
});
330330
await expect(configConstructorPool.instantiate(config, settings)).rejects
331-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
331+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
332332
});
333333

334334
it('instantiated with a config with all parameters with multiple values as list should throw', async() => {
@@ -339,7 +339,7 @@ describe('construction with component configs as Resource', () => {
339339
'http://example.org/n3#comments': { list: [ '"C1"', '"C2"' ]},
340340
});
341341
await expect(configConstructorPool.instantiate(config, settings)).rejects
342-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
342+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
343343
});
344344

345345
describe('instantiated with a config with variables', () => {
@@ -370,7 +370,7 @@ describe('construction with component configs as Resource', () => {
370370

371371
it('with undefined variables', async() => {
372372
await expect(configConstructorPool.instantiate(config, settings)).rejects
373-
.toThrowError(/^Undefined variable: ex:var1/u);
373+
.toThrow(/^Undefined variable: ex:var1/u);
374374
});
375375

376376
it('with variables that are undefined', async() => {
@@ -379,7 +379,7 @@ describe('construction with component configs as Resource', () => {
379379
'ex:var3': 'C',
380380
};
381381
await expect(configConstructorPool.instantiate(config, settings)).rejects
382-
.toThrowError(/^Undefined variable: ex:var2/u);
382+
.toThrow(/^Undefined variable: ex:var2/u);
383383
});
384384
});
385385
});
@@ -422,7 +422,7 @@ describe('construction with component configs as Resource', () => {
422422
types: 'http://example.org/n3#Lexer',
423423
});
424424
await expect(configConstructorPool.instantiate(config, settings)).rejects
425-
.toThrowError(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
425+
.toThrow(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
426426
});
427427
});
428428

@@ -773,7 +773,7 @@ describe('construction with component configs as Resource', () => {
773773
});
774774
await expect(configConstructorPool.instantiate(config, settings)).rejects
775775
// eslint-disable-next-line max-len
776-
.toThrowError(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
776+
.toThrow(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
777777
});
778778

779779
it('instantiated with a config with all parameters as multiple values in list', async() => {
@@ -785,7 +785,7 @@ describe('construction with component configs as Resource', () => {
785785
'http://example.org/n3#comments': [ '"true"' ],
786786
});
787787
await expect(configConstructorPool.instantiate(config, settings)).rejects
788-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
788+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
789789
});
790790

791791
it('instantiated with a config with all parameters as singular value in RDF list', async() => {
@@ -842,15 +842,15 @@ describe('construction with component configs as Resource', () => {
842842
'http://example.org/n3#comments': '"true"',
843843
});
844844
await expect(configConstructorPool.instantiate(config, settings)).rejects
845-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
845+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
846846
});
847847

848848
it('instantiated with a config without parameters', async() => {
849849
const config = objectLoader.createCompactedResource({
850850
types: 'http://example.org/n3#Lexer',
851851
});
852852
await expect(configConstructorPool.instantiate(config, settings)).rejects
853-
.toThrowError(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
853+
.toThrow(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
854854
});
855855
});
856856

@@ -879,7 +879,7 @@ describe('construction with component configs as Resource', () => {
879879
'http://example.org/n3#comments': '"true"',
880880
});
881881
await expect(configConstructorPool.instantiate(config, settings)).rejects
882-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
882+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
883883
});
884884

885885
it('instantiated with a config without parameters', async() => {

test/integration/instantiateResourceConfigComponentMapped-test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('construction with mapped component configs as Resource', () => {
186186
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
187187
});
188188
await expect(configConstructorPool.instantiate(config, settings)).rejects
189-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
189+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
190190
});
191191

192192
it('instantiated with a config with all parameters with multiple values as list', async() => {
@@ -271,7 +271,7 @@ describe('construction with mapped component configs as Resource', () => {
271271
'http://example.org/n3#comments': '"true"',
272272
});
273273
await expect(configConstructorPool.instantiate(config, settings)).rejects
274-
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
274+
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
275275
});
276276

277277
it('instantiated with a config with all parameters as singular value in list', async() => {
@@ -299,7 +299,7 @@ describe('construction with mapped component configs as Resource', () => {
299299
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
300300
});
301301
await expect(configConstructorPool.instantiate(config, settings)).rejects
302-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
302+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
303303
});
304304

305305
it('instantiated with a config with all parameters with multiple values as list', async() => {
@@ -363,7 +363,7 @@ describe('construction with mapped component configs as Resource', () => {
363363
'http://example.org/n3#lineMode': '"true"',
364364
});
365365
await expect(configConstructorPool.instantiate(config, settings)).rejects
366-
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
366+
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
367367
});
368368

369369
it('instantiated with a config with all parameters as list', async() => {
@@ -373,7 +373,7 @@ describe('construction with mapped component configs as Resource', () => {
373373
});
374374
await expect(configConstructorPool.instantiate(config, settings)).rejects
375375
// eslint-disable-next-line max-len
376-
.toThrowError(/The value "\[true\]" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
376+
.toThrow(/The value "\[true\]" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
377377
});
378378

379379
it('instantiated with a config with all parameters as nested list', async() => {
@@ -453,7 +453,7 @@ describe('construction with mapped component configs as Resource', () => {
453453
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
454454
});
455455
await expect(configConstructorPool.instantiate(config, settings)).rejects
456-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
456+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
457457
});
458458

459459
it('instantiated with a config with all parameters with multiple values as list', async() => {
@@ -464,7 +464,7 @@ describe('construction with mapped component configs as Resource', () => {
464464
'http://example.org/n3#comments': { list: [ '"C1"', '"C2"' ]},
465465
});
466466
await expect(configConstructorPool.instantiate(config, settings)).rejects
467-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
467+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
468468
});
469469

470470
describe('instantiated with a config with variables', () => {
@@ -495,7 +495,7 @@ describe('construction with mapped component configs as Resource', () => {
495495

496496
it('with undefined variables', async() => {
497497
await expect(configConstructorPool.instantiate(config, settings)).rejects
498-
.toThrowError(/^Undefined variable: ex:var1/u);
498+
.toThrow(/^Undefined variable: ex:var1/u);
499499
});
500500

501501
it('with variables that are undefined', async() => {
@@ -504,7 +504,7 @@ describe('construction with mapped component configs as Resource', () => {
504504
'ex:var3': 'C',
505505
};
506506
await expect(configConstructorPool.instantiate(config, settings)).rejects
507-
.toThrowError(/^Undefined variable: ex:var2/u);
507+
.toThrow(/^Undefined variable: ex:var2/u);
508508
});
509509
});
510510
});
@@ -569,7 +569,7 @@ describe('construction with mapped component configs as Resource', () => {
569569
types: 'http://example.org/n3#Lexer',
570570
});
571571
await expect(configConstructorPool.instantiate(config, settings)).rejects
572-
.toThrowError(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
572+
.toThrow(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
573573
});
574574
});
575575

@@ -1074,7 +1074,7 @@ describe('construction with mapped component configs as Resource', () => {
10741074
});
10751075
await expect(configConstructorPool.instantiate(config, settings)).rejects
10761076
// eslint-disable-next-line max-len
1077-
.toThrowError(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
1077+
.toThrow(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
10781078
});
10791079

10801080
it('instantiated with a config with all parameters as multiple values in list', async() => {
@@ -1086,7 +1086,7 @@ describe('construction with mapped component configs as Resource', () => {
10861086
'http://example.org/n3#comments': [ '"true"' ],
10871087
});
10881088
await expect(configConstructorPool.instantiate(config, settings)).rejects
1089-
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
1089+
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
10901090
});
10911091

10921092
it('instantiated with a config with all parameters as singular value in RDF list', async() => {
@@ -1165,15 +1165,15 @@ describe('construction with mapped component configs as Resource', () => {
11651165
'http://example.org/n3#comments': '"true"',
11661166
});
11671167
await expect(configConstructorPool.instantiate(config, settings)).rejects
1168-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
1168+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
11691169
});
11701170

11711171
it('instantiated with a config without parameters', async() => {
11721172
const config = objectLoader.createCompactedResource({
11731173
types: 'http://example.org/n3#Lexer',
11741174
});
11751175
await expect(configConstructorPool.instantiate(config, settings)).rejects
1176-
.toThrowError(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
1176+
.toThrow(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
11771177
});
11781178
});
11791179

@@ -1224,7 +1224,7 @@ describe('construction with mapped component configs as Resource', () => {
12241224
'http://example.org/n3#comments': '"true"',
12251225
});
12261226
await expect(configConstructorPool.instantiate(config, settings)).rejects
1227-
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
1227+
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
12281228
});
12291229

12301230
it('instantiated with a config without parameters', async() => {

test/unit/construction/ConfigConstructor-test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('ConfigConstructor', () => {
7676
objectLoader.createCompactedResource('"GHI"'),
7777
];
7878
await expect(constructor.getArgumentValues(values, settings)).rejects
79-
.toThrowError(`Detected multiple values for an argument. RDF lists should be used for defining multiple values.`);
79+
.toThrow(`Detected multiple values for an argument. RDF lists should be used for defining multiple values.`);
8080
});
8181

8282
it('should handle an RDF list', async() => {
@@ -221,7 +221,7 @@ describe('ConfigConstructor', () => {
221221
},
222222
});
223223
await expect(constructor.getArgumentValue(resource, settings)).rejects
224-
.toThrowError(/^Missing key in fields entry/u);
224+
.toThrow(/^Missing key in fields entry/u);
225225
});
226226

227227
it('can use dereferenced IRI values as keys', async() => {
@@ -267,7 +267,7 @@ describe('ConfigConstructor', () => {
267267
},
268268
});
269269
await expect(constructor.getArgumentValue(resource, settings)).rejects
270-
.toThrowError(/^Illegal non-string key \(ex:abc as NamedNode\) in fields entry/u);
270+
.toThrow(/^Illegal non-string key \(ex:abc as NamedNode\) in fields entry/u);
271271
});
272272

273273
it('should ignore fields without value', async() => {
@@ -348,7 +348,7 @@ describe('ConfigConstructor', () => {
348348
],
349349
});
350350
await expect(constructor.getArgumentValue(resource, settings)).rejects
351-
.toThrowError(/^Missing value in array elements entry/u);
351+
.toThrow(/^Missing value in array elements entry/u);
352352
});
353353
});
354354

@@ -519,7 +519,7 @@ describe('ConfigConstructor', () => {
519519
it('should throw on graph terms', async() => {
520520
const resource = new Resource({ term: DF.defaultGraph() });
521521
await expect(constructor.getArgumentValue(resource, settings)).rejects
522-
.toThrowError(/^Unsupported argument value during config construction/u);
522+
.toThrow(/^Unsupported argument value during config construction/u);
523523
});
524524
});
525525

@@ -565,7 +565,7 @@ describe('ConfigConstructor', () => {
565565
arguments: '"ABC"',
566566
});
567567
await expect(constructor.createArguments(config, settings)).rejects
568-
.toThrowError(/^Detected non-RDF-list as value for config arguments/u);
568+
.toThrow(/^Detected non-RDF-list as value for config arguments/u);
569569
});
570570
});
571571

0 commit comments

Comments
 (0)