Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9a65c03
style: format regression test files with prettier
Yogu Oct 30, 2025
07e376c
test: allow regression suites to have a typescript file to init test …
Yogu Oct 29, 2025
f59c831
test: include suite name (as suite/test) in filter specified by --reg…
Yogu Oct 29, 2025
b9667c3
test: support suite-global meta file
Yogu Oct 29, 2025
fb2ac15
test: set query memory limit in regression tests
Yogu Oct 29, 2025
75d5059
test: avoid confusing global state in regression test logger
Yogu Oct 29, 2025
8209b31
refactor: avoid using globalContext only to get the logger
Yogu Oct 29, 2025
0384bfe
test: make clearing the regression test database more explicit
Yogu Oct 29, 2025
2aa5c58
test: remove support for anonymous operations in regression tests
Yogu Oct 30, 2025
10f645c
test: organize regression tests in one directory per test
Yogu Oct 30, 2025
b7b71ed
test: print AQL queries for all regression tests
Yogu Oct 30, 2025
66c9460
chore: fix husky configuration
Yogu Oct 31, 2025
766560d
style: reformat regression test result files with prettier
Yogu Nov 3, 2025
2cc271f
test: insert trailing newline in files generated with --save-actual-a…
Yogu Oct 31, 2025
f3e1135
test: add tests for excessive memory usage in traversal and collect f…
Yogu Oct 29, 2025
7951835
chore: upgrade lib to ES2023
Yogu Nov 4, 2025
4a6419d
refactor: consistently use decapitalized type names for variables
Yogu Oct 31, 2025
92df6ec
chore: update mocha
Yogu Nov 6, 2025
f715cb2
perf: skip null check for parent and root fields
Yogu Oct 30, 2025
888d323
perf: do not prevent the reduce-extraction-to-projection optimization…
Yogu Oct 30, 2025
59c7ab7
wip: test: add more test for traversals
Yogu Nov 4, 2025
ad8f739
wip: perf: improve query memory usage of collect fields
Yogu Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
51 changes: 35 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"stop_arangodb": "arangodb --starter.mode=single --starter.local --starter.port=8528 --starter.data-dir=./db stop",
"compile-json-schema": "ajv --all-errors true compile -s src/schema/preparation/source-validation-modules/schema/schema.json -o src/schema/preparation/source-validation-modules/schema/validate-schema.js",
"mrproper": "rimraf dist db node_modules package-lock.json",
"prepare": "husky install",
"prepare": "husky",
"dev": "node cruddl-dev.js",
"knip": "knip",
"knip:prod": "knip --production"
Expand Down Expand Up @@ -60,11 +60,11 @@
"deep-equal-in-any-order": "^1.1.20",
"express": "^4.19.2",
"graphql": "^16.6.0",
"husky": "^8.0.1",
"husky": "^9.1.7",
"knip": "^5.27.0",
"lint-staged": "^15.2.10",
"log4js": "^6.6.0",
"mocha": "^11.7.1",
"mocha": "^11.7.5",
"nyc": "^15.1.0",
"prettier": "^3.3.3",
"rimraf": "^3.0.2",
Expand Down Expand Up @@ -111,11 +111,6 @@
],
"all": true
},
"husky": {
"hooks": {
"pre-commit": "npx lint-staged"
}
},
"lint-staged": {
"*": "prettier --ignore-unknown --write"
}
Expand Down
3 changes: 2 additions & 1 deletion spec/dev/model/simple.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Skill @valueObject {
}

"A superhero movie"
type Movie @rootEntity @roles(read: ["logistics-reader"]) {
type Movie @rootEntity {
name: String
"All the heroes starring in this movie"
heroes: [Hero] @relation
Expand All @@ -71,6 +71,7 @@ type Movie @rootEntity @roles(read: ["logistics-reader"]) {
type Director @rootEntity {
name: String
movies: [Movie] @relation(inverseOf: "director")
allMissions: [Mission] @collect(path: "movies.heroes.missions", aggregate: DISTINCT)
}

"A description of a hero suit"
Expand Down
6 changes: 3 additions & 3 deletions spec/dev/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import bodyParser from 'body-parser';
import cors from 'cors';
import express from 'express';
import { resolve } from 'path';
import { ArangoDBAdapter, Project } from '../..';
import { ArangoDBAdapter, ExecutionOptions, Project } from '../..';
import { globalContext } from '../../src/config/global';
import { InMemoryAdapter } from '../../src/database/inmemory';
import { getMetaSchema } from '../../src/meta-schema/meta-schema';
Expand All @@ -18,7 +18,7 @@ const databaseURL = 'http://root:@localhost:8529';
// const databaseURL = 'http://root:@localhost:7050';

export async function start() {
const loggerProvider = new Log4jsLoggerProvider('error');
const loggerProvider = new Log4jsLoggerProvider();

let db;
if (process.argv.includes('--db=in-memory')) {
Expand All @@ -44,7 +44,7 @@ export async function start() {
);
},
getOperationIdentifier: ({ context }) => context as object, // each operation is executed with an unique context object
getExecutionOptions: ({ context }: { context: any }) => {
getExecutionOptions: ({ context }: { context: any }): ExecutionOptions => {
return {
authContext: { authRoles: ['allusers'] },
recordTimings: true,
Expand Down
13 changes: 4 additions & 9 deletions spec/helpers/log4js-logger-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ import { getLogger } from 'log4js';
import { Logger, LoggerProvider } from '../../src/config/logging';

export class Log4jsLoggerProvider implements LoggerProvider {
constructor(
public readonly level: string,
public readonly levelByCategory: { [category: string]: string } = {},
) {}

getLogger(category: string): Logger {
const logger = getLogger(category);
logger.level =
category in this.levelByCategory ? this.levelByCategory[category] : this.level;
return logger;
// note: we used to change the level here, but that does not work because in log4js,
// everything is global state (you're actually changing a category's level globally if you
// set .level on a logger)
return getLogger(category);
}
}
33 changes: 33 additions & 0 deletions spec/helpers/warn-and-error-logger-provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Logger, LoggerProvider } from '../../src/config/logging';

export class WarnAndErrorLoggerProvider implements LoggerProvider {
getLogger(category: string): Logger {
// note: can't use log4js's getLogger because we can't set a log level on a logger
// (setting .level on a logger actually changes the level globally for that category)
return new WarnAndErrorLogger(category);
}
}

export class WarnAndErrorLogger implements Logger {
constructor(private category?: string) {}

trace = () => {};
debug = () => {};
info = () => {};
warn = (message: string, ...args: unknown[]) =>
console.warn(`[WARN] ${this.category}: ${message}`, ...args);
error = (message: string, ...args: unknown[]) =>
console.error(`[ERROR] ${this.category}: ${message}`, ...args);
fatal = (message: string, ...args: unknown[]) =>
console.error(`[FATAL] ${this.category}: ${message}`, ...args);

level = 'warn';

isLevelEnabled = (level: string) => ['warn', 'error', 'fatal'].includes(level.toLowerCase());
isTraceEnabled = () => false;
isDebugEnabled = () => false;
isInfoEnabled = () => false;
isWarnEnabled = () => true;
isErrorEnabled = () => true;
isFatalEnabled = () => true;
}
6 changes: 3 additions & 3 deletions spec/performance/support/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { ArangoDBAdapter } from '../../../src/database/arangodb';
import { Project } from '../../../src/project/project';
import { loadProjectFromDir } from '../../../src/project/project-from-fs';
import { range } from '../../../src/utils/utils';
import { Log4jsLoggerProvider } from '../../helpers/log4js-logger-provider';
import { createTempDatabase } from '../../regression/initialization';
import { WarnAndErrorLoggerProvider } from '../../helpers/warn-and-error-logger-provider';

// arangojs typings for this are completely broken
// arangojs typings for this are completely bro ken
export const aql: (template: TemplateStringsArray, ...args: ReadonlyArray<any>) => any =
require('arangojs').aql;

Expand All @@ -22,7 +22,7 @@ export interface TestEnvironment {
}

const schemaContext: ProjectOptions = {
loggerProvider: new Log4jsLoggerProvider('warn'),
loggerProvider: new WarnAndErrorLoggerProvider(),
getExecutionOptions: ({}) => ({ authContext: { authRoles: ['admin'] } }),
};

Expand Down
12 changes: 0 additions & 12 deletions spec/regression/access-groups/tests/accounting.result.json

This file was deleted.

15 changes: 15 additions & 0 deletions spec/regression/access-groups/tests/accounting/aql/allFiles.aql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
RETURN {
"allFiles": (
FOR v_file1
IN (
FOR v_item1
IN @@files
FILTER (v_item1.`accessGroup` IN @var1)
RETURN v_item1
)
SORT (v_file1.`name`)
RETURN {
"name": v_file1.`name`
}
)
}
14 changes: 14 additions & 0 deletions spec/regression/access-groups/tests/accounting/result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"allFiles": {
"data": {
"allFiles": [
{
"name": "accounting"
},
{
"name": "public"
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
query allFiles {
allFiles(orderBy: name_ASC) {
name
}
Expand Down
Loading
Loading