@traqula/test-utils 1.1.2 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/lib/generators/algebraGenerators.js +28 -12
- package/dist/cjs/lib/generators/algebraGenerators.js.map +1 -1
- package/dist/cjs/lib/generators/utils.js +56 -4
- package/dist/cjs/lib/generators/utils.js.map +1 -1
- package/dist/cjs/lib/indexCjs.js +31 -0
- package/dist/cjs/lib/indexCjs.js.map +1 -0
- package/dist/esm/lib/generators/algebraGenerators.js +28 -12
- package/dist/esm/lib/generators/algebraGenerators.js.map +1 -1
- package/dist/esm/lib/generators/utils.d.ts +20 -0
- package/dist/esm/lib/generators/utils.js +55 -4
- package/dist/esm/lib/generators/utils.js.map +1 -1
- package/dist/esm/lib/index.d.ts +1 -1
- package/dist/esm/lib/index.js +10 -1
- package/dist/esm/lib/index.js.map +1 -1
- package/package.json +7 -4
- package/statics/algebra/algebra/sparql12/codepoint-esc-05.json +38 -0
- package/statics/algebra/algebra/sparql12/codepoint-esc-06.json +38 -0
- package/statics/algebra/algebra/sparql12/codepoint-esc-07.json +38 -0
- package/statics/algebra/algebra-blank-to-var/sparql12/codepoint-esc-05.json +38 -0
- package/statics/algebra/algebra-blank-to-var/sparql12/codepoint-esc-06.json +38 -0
- package/statics/algebra/algebra-blank-to-var/sparql12/codepoint-esc-07.json +38 -0
- package/statics/algebra/canonical-sparql/base/sparql12/codepoint-esc-05.sparql +3 -0
- package/statics/algebra/canonical-sparql/base/sparql12/codepoint-esc-06.sparql +3 -0
- package/statics/algebra/canonical-sparql/base/sparql12/codepoint-esc-07.sparql +3 -0
- package/statics/algebra/canonical-sparql/blank-to-var/sparql12/codepoint-esc-05.sparql +3 -0
- package/statics/algebra/canonical-sparql/blank-to-var/sparql12/codepoint-esc-06.sparql +3 -0
- package/statics/algebra/canonical-sparql/blank-to-var/sparql12/codepoint-esc-07.sparql +3 -0
- package/statics/algebra/sparql/sparql12/codepoint-esc-05.sparql +6 -0
- package/statics/algebra/sparql/sparql12/codepoint-esc-06.sparql +6 -0
- package/statics/algebra/sparql/sparql12/codepoint-esc-07.sparql +6 -0
- package/statics/ast/ast-source-tracked/sparql-1-2/codepoint-esc-05.json +97 -0
- package/statics/ast/ast-source-tracked/sparql-1-2/codepoint-esc-06.json +97 -0
- package/statics/ast/ast-source-tracked/sparql-1-2/codepoint-esc-07.json +97 -0
- package/statics/ast/sparql/sparql-1-2/codepoint-esc-05.sparql +6 -0
- package/statics/ast/sparql/sparql-1-2/codepoint-esc-06.sparql +6 -0
- package/statics/ast/sparql/sparql-1-2/codepoint-esc-07.sparql +6 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-01-bad.sparql +2 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-02-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-03-bad.sparql +6 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-04-bad.sparql +7 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-05-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/codepoint-esc-06-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/surrogate-esc-01-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/surrogate-esc-02-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/surrogate-esc-03-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/surrogate-esc-04-bad.sparql +5 -0
- package/statics/ast/sparql/sparql-1-2-invalid/surrogate-esc-05-bad.sparql +5 -0
- package/statics/ast/sparql-generated/sparql-1-2/codepoint-esc-05.sparql +3 -0
- package/statics/ast/sparql-generated/sparql-1-2/codepoint-esc-06.sparql +3 -0
- package/statics/ast/sparql-generated/sparql-1-2/codepoint-esc-07.sparql +3 -0
- package/statics/ast/sparql-generated-compact/sparql-1-2/codepoint-esc-05.sparql +1 -0
- package/statics/ast/sparql-generated-compact/sparql-1-2/codepoint-esc-06.sparql +1 -0
- package/statics/ast/sparql-generated-compact/sparql-1-2/codepoint-esc-07.sparql +1 -0
|
@@ -8,16 +8,32 @@ const node_fs_1 = require("node:fs");
|
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
9
|
const fileUtils_js_1 = require("../fileUtils.js");
|
|
10
10
|
const utils_js_1 = require("./utils.js");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
// Computed lazily inside each generator so that getStaticFilePath() is not
|
|
12
|
+
// called at module-evaluation time. This avoids an ESM initialisation-order
|
|
13
|
+
// issue where algebraGenerators.js would execute before index.ts has had a
|
|
14
|
+
// chance to call _initStaticsRoot().
|
|
15
|
+
function getRootDir() {
|
|
16
|
+
return (0, utils_js_1.getStaticFilePath)('algebra');
|
|
17
|
+
}
|
|
18
|
+
function getRootSparql() {
|
|
19
|
+
return (0, node_path_1.join)(getRootDir(), 'sparql');
|
|
20
|
+
}
|
|
21
|
+
function getRootJson() {
|
|
22
|
+
return (0, node_path_1.join)(getRootDir(), 'algebra');
|
|
23
|
+
}
|
|
24
|
+
function getRootJsonBlankToVariable() {
|
|
25
|
+
return (0, node_path_1.join)(getRootDir(), 'algebra-blank-to-var');
|
|
26
|
+
}
|
|
27
|
+
function getRootCanonicalSparql() {
|
|
28
|
+
return (0, node_path_1.join)(getRootDir(), 'canonical-sparql', 'base');
|
|
29
|
+
}
|
|
30
|
+
function getRootCanonicalSparqlBlankToVar() {
|
|
31
|
+
return (0, node_path_1.join)(getRootDir(), 'canonical-sparql', 'blank-to-var');
|
|
32
|
+
}
|
|
17
33
|
function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
18
34
|
// Relative path starting from roots declared above.
|
|
19
35
|
function* subGen(relativePath) {
|
|
20
|
-
const absolutePath = (0, node_path_1.join)(blankToVariable ?
|
|
36
|
+
const absolutePath = (0, node_path_1.join)(blankToVariable ? getRootJsonBlankToVariable() : getRootJson(), relativePath);
|
|
21
37
|
if ((0, node_fs_1.lstatSync)(absolutePath).isDirectory()) {
|
|
22
38
|
// Recursion
|
|
23
39
|
for (const sub of (0, node_fs_1.readdirSync)(absolutePath)) {
|
|
@@ -26,8 +42,8 @@ function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
26
42
|
}
|
|
27
43
|
else {
|
|
28
44
|
const name = relativePath.replace(/\.json$/u, '');
|
|
29
|
-
const sparqlPath = (0, node_path_1.join)(
|
|
30
|
-
const canonicalSparqlPath = (0, node_path_1.join)(blankToVariable ?
|
|
45
|
+
const sparqlPath = (0, node_path_1.join)(getRootSparql(), relativePath.replace(/\.json/u, '.sparql'));
|
|
46
|
+
const canonicalSparqlPath = (0, node_path_1.join)(blankToVariable ? getRootCanonicalSparqlBlankToVar() : getRootCanonicalSparql(), relativePath.replace(/\.json/u, '.sparql'));
|
|
31
47
|
yield {
|
|
32
48
|
name,
|
|
33
49
|
json: JSON.parse((0, fileUtils_js_1.readFileSync)(absolutePath)),
|
|
@@ -37,7 +53,7 @@ function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
37
53
|
};
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
|
-
const subfolders = (0, node_fs_1.readdirSync)(blankToVariable ?
|
|
56
|
+
const subfolders = (0, node_fs_1.readdirSync)(blankToVariable ? getRootJsonBlankToVariable() : getRootJson());
|
|
41
57
|
if (subfolders.includes(suite)) {
|
|
42
58
|
yield* subGen(suite);
|
|
43
59
|
}
|
|
@@ -48,7 +64,7 @@ function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
48
64
|
*/
|
|
49
65
|
function* sparqlQueries(suite) {
|
|
50
66
|
function* subGen(relativePath) {
|
|
51
|
-
const absolutePath = (0, node_path_1.join)(
|
|
67
|
+
const absolutePath = (0, node_path_1.join)(getRootSparql(), relativePath);
|
|
52
68
|
if ((0, node_fs_1.lstatSync)(absolutePath).isDirectory()) {
|
|
53
69
|
// Recursion
|
|
54
70
|
for (const sub of (0, node_fs_1.readdirSync)(absolutePath)) {
|
|
@@ -64,7 +80,7 @@ function* sparqlQueries(suite) {
|
|
|
64
80
|
};
|
|
65
81
|
}
|
|
66
82
|
}
|
|
67
|
-
const subfolders = (0, node_fs_1.readdirSync)(
|
|
83
|
+
const subfolders = (0, node_fs_1.readdirSync)(getRootSparql());
|
|
68
84
|
if (subfolders.includes(suite)) {
|
|
69
85
|
yield* subGen(suite);
|
|
70
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraGenerators.js","sourceRoot":"","sources":["../../../../lib/generators/algebraGenerators.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"algebraGenerators.js","sourceRoot":"","sources":["../../../../lib/generators/algebraGenerators.ts"],"names":[],"mappings":";;AAmDA,gDA+BC;AAOD,sCAsBC;AAUD,gEAsBC;AA/ID,6CAA6C;AAC7C,qCAAiD;AACjD,yCAAiC;AACjC,kDAAyD;AAEzD,yCAA+C;AAE/C,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,qCAAqC;AACrC,SAAS,UAAU;IACjB,OAAO,IAAA,4BAAiB,EAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,aAAa;IACpB,OAAO,IAAA,gBAAI,EAAC,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,WAAW;IAClB,OAAO,IAAA,gBAAI,EAAC,UAAU,EAAE,EAAE,SAAS,CAAC,CAAC;AACvC,CAAC;AACD,SAAS,0BAA0B;IACjC,OAAO,IAAA,gBAAI,EAAC,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC;AACpD,CAAC;AACD,SAAS,sBAAsB;IAC7B,OAAO,IAAA,gBAAI,EAAC,UAAU,EAAE,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;A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C;aAC3C,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,qBAAW,EAAC,aAAa,EAAE,CAAC,CAAC;IAChD,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAID;;;;;GAKG;AACH,QAAe,CAAC,CAAC,0BAA0B,CACzC,KAA2B,EAC3B,MAAkC;IAElC,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,SAAS,CAAC,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC9D,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;YACnD,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM;YACJ,IAAI;YACJ,OAAO,EAAE,KAAK,IAAG,EAAE;gBACjB,MAAM,KAAK,GAAG,MAAM,IAAA,uBAAQ,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;gBACpD,OAAO;oBACL,KAAK;iBACN,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport { lstatSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { readFile, readFileSync } from '../fileUtils.js';\nimport type { NegativeTest } from './generators.js';\nimport { getStaticFilePath } from './utils.js';\n\n// Computed lazily inside each generator so that getStaticFilePath() is not\n// called at module-evaluation time. This avoids an ESM initialisation-order\n// issue where algebraGenerators.js would execute before index.ts has had a\n// chance to call _initStaticsRoot().\nfunction getRootDir(): string {\n return getStaticFilePath('algebra');\n}\nfunction getRootSparql(): string {\n return join(getRootDir(), 'sparql');\n}\nfunction getRootJson(): string {\n return join(getRootDir(), 'algebra');\n}\nfunction getRootJsonBlankToVariable(): string {\n return join(getRootDir(), 'algebra-blank-to-var');\n}\nfunction getRootCanonicalSparql(): string {\n return join(getRootDir(), 'canonical-sparql', 'base');\n}\nfunction getRootCanonicalSparqlBlankToVar(): string {\n return join(getRootDir(), 'canonical-sparql', 'blank-to-var');\n}\n\nexport interface algebraTestGen {\n name: string;\n json: unknown;\n quads: boolean;\n sparql: string | undefined;\n canonicalSparql: string | undefined;\n}\n\nexport type AlgebraTestSuite = 'dawg-syntax' | 'sparql-1.1' | 'sparql11-query' | 'sparql12';\n\n/**\n * Yields algebra-level test cases from the static test fixtures.\n * Each test provides a SPARQL query, expected algebra JSON, and optionally a canonical SPARQL string.\n * @param suite - The test suite to iterate.\n * @param blankToVariable - Whether to use the blank-to-variable fixture variant.\n * @param getSPARQL - Whether to load the SPARQL and canonical SPARQL strings.\n */\nexport function sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: true):\nGenerator<algebraTestGen & { sparql: string; canonicalSparql: string }>;\nexport function sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen>;\nexport function* sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen> {\n // Relative path starting from roots declared above.\n function* subGen(relativePath: string): Generator<algebraTestGen> {\n const absolutePath = join(blankToVariable ? getRootJsonBlankToVariable() : getRootJson(), relativePath);\n if (lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of readdirSync(absolutePath)) {\n yield* subGen(join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.json$/u, '');\n const sparqlPath = join(getRootSparql(), relativePath.replace(/\\.json/u, '.sparql'));\n const canonicalSparqlPath = join(\n blankToVariable ? getRootCanonicalSparqlBlankToVar() : getRootCanonicalSparql(),\n relativePath.replace(/\\.json/u, '.sparql'),\n );\n yield {\n name,\n json: JSON.parse(readFileSync(absolutePath)),\n sparql: getSPARQL ? readFileSync(sparqlPath, 'utf8') : undefined,\n canonicalSparql: getSPARQL ? readFileSync(canonicalSparqlPath, 'utf-8') : undefined,\n quads: name.endsWith('-quads'),\n };\n }\n }\n\n const subfolders = readdirSync(blankToVariable ? getRootJsonBlankToVariable() : getRootJson());\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n\ntype GenQuery = { query: string; name: string };\n/**\n * Yields raw SPARQL query strings from the static test fixtures for a given suite.\n * @param suite - The test suite to iterate.\n */\nexport function* sparqlQueries(suite: AlgebraTestSuite): Generator<GenQuery> {\n function* subGen(relativePath: string): Generator<GenQuery> {\n const absolutePath = join(getRootSparql(), relativePath);\n if (lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of readdirSync(absolutePath)) {\n yield* subGen(join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.sparql$/u, '');\n const content = readFileSync(absolutePath, 'utf-8');\n yield {\n name,\n query: content.replaceAll(/\\r?\\n/gu, '\\n'),\n };\n }\n }\n\n const subfolders = readdirSync(getRootSparql());\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n\nexport type NegativeAlgebraSuite = 'sparql-1.1-negative' | 'sparql-1.2-negative';\n\n/**\n * Yields test cases for negative (invalid) algebra-level tests.\n * Each test provides a SPARQL query that should fail during algebra transformation.\n * @param suite - The negative test suite to iterate.\n * @param filter - Optional filter predicate applied to the test file name.\n */\nexport function* sparqlAlgebraNegativeTests(\n suite: NegativeAlgebraSuite,\n filter?: (name: string) => boolean,\n): Generator<NegativeTest> {\n const astDir = getStaticFilePath('algebra');\n const sparqlDir = join(astDir, 'sparql', suite);\n const statics = readdirSync(sparqlDir);\n for (const file of statics.filter(f => f.endsWith('.sparql'))) {\n if (filter && !filter(file.replace('.sparql', ''))) {\n continue;\n }\n const name = file.replace(/\\.sparql$/u, '');\n yield {\n name,\n statics: async() => {\n const query = await readFile(join(sparqlDir, file));\n return {\n query,\n };\n },\n };\n }\n}\n"]}
|
|
@@ -3,18 +3,70 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._initStaticsRoot = _initStaticsRoot;
|
|
6
7
|
exports.getStaticFilePath = getStaticFilePath;
|
|
7
8
|
/* eslint-disable import/no-nodejs-modules */
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
8
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Walk up the directory tree from startDir until a directory that contains
|
|
13
|
+
* both a `package.json` and a `statics` folder is found. Stopping at the
|
|
14
|
+
* package-root boundary avoids the risk of matching an unrelated `statics/`
|
|
15
|
+
* folder higher up the filesystem.
|
|
16
|
+
*/
|
|
17
|
+
function resolveStaticsPath(startDir) {
|
|
18
|
+
let dir = startDir;
|
|
19
|
+
while (true) {
|
|
20
|
+
if ((0, node_fs_1.existsSync)(node_path_1.default.join(dir, 'statics')) && (0, node_fs_1.existsSync)(node_path_1.default.join(dir, 'package.json'))) {
|
|
21
|
+
return node_path_1.default.join(dir, 'statics');
|
|
22
|
+
}
|
|
23
|
+
const parent = node_path_1.default.dirname(dir);
|
|
24
|
+
// Guard: filesystem root reached before finding a package boundary — unreachable in practice.
|
|
25
|
+
/* v8 ignore next 3 */
|
|
26
|
+
if (parent === dir) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
dir = parent;
|
|
30
|
+
}
|
|
31
|
+
// Guard: statics not found even after reaching the filesystem root — unreachable in practice.
|
|
32
|
+
/* v8 ignore next */
|
|
33
|
+
throw new Error(`Cannot locate statics/ directory (with co-located package.json) starting from ${startDir}`);
|
|
34
|
+
}
|
|
35
|
+
// Resolved on demand after the package entry point calls _initStaticsRoot().
|
|
36
|
+
let _staticsPath;
|
|
37
|
+
/**
|
|
38
|
+
* Initialises the statics root from the directory of the package entry point.
|
|
39
|
+
* Must be called before any test fixture helpers are invoked.
|
|
40
|
+
*
|
|
41
|
+
* The package entry points (index.ts for ESM, index.cts for CJS) call this
|
|
42
|
+
* with their own `path.dirname(fileURLToPath(import.meta.url))` or `__dirname`
|
|
43
|
+
* respectively, so this module contains no module-system-specific syntax and
|
|
44
|
+
* compiles correctly under both `module: NodeNext` and `module: CommonJS`.
|
|
45
|
+
*
|
|
46
|
+
* Design note — eager-init vs lazy resolution:
|
|
47
|
+
* An alternative would be to resolve the statics path lazily inside
|
|
48
|
+
* getStaticFilePath() on first call (eliminating _initStaticsRoot and the
|
|
49
|
+
* entry-point coupling entirely). Eager-init was chosen instead because lazy
|
|
50
|
+
* resolution cannot safely use import.meta.url in a CommonJS build, and
|
|
51
|
+
* __dirname is not available in an ESM build. The entry-point side-effect
|
|
52
|
+
* approach lets this module stay free of module-system-specific syntax while
|
|
53
|
+
* still capturing the correct anchor directory at load time.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
function _initStaticsRoot(dir) {
|
|
57
|
+
_staticsPath = resolveStaticsPath(dir);
|
|
58
|
+
}
|
|
12
59
|
/**
|
|
13
60
|
* Resolve a path relative to the test-utils statics directory.
|
|
14
61
|
* @param paths - Path segments to join after the statics root.
|
|
15
62
|
* @returns The absolute path to the static fixture.
|
|
16
63
|
*/
|
|
17
64
|
function getStaticFilePath(...paths) {
|
|
18
|
-
|
|
65
|
+
// Guard: entry point must call _initStaticsRoot() before this helper is used.
|
|
66
|
+
/* v8 ignore next 3 */
|
|
67
|
+
if (!_staticsPath) {
|
|
68
|
+
throw new Error('getStaticFilePath() called before the package entry point initialised the statics root');
|
|
69
|
+
}
|
|
70
|
+
return node_path_1.default.join(_staticsPath, ...paths);
|
|
19
71
|
}
|
|
20
72
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/generators/utils.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/generators/utils.ts"],"names":[],"mappings":";;;;;AAmDA,4CAEC;AAOD,8CAOC;AAnED,6CAA6C;AAC7C,qCAAqC;AACrC,0DAA6B;AAE7B;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,IAAA,oBAAU,EAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,IAAI,IAAA,oBAAU,EAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACxF,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,MAAM,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,8FAA8F;QAC9F,sBAAsB;QACtB,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM;QACR,CAAC;QACD,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,8FAA8F;IAC9F,oBAAoB;IACpB,MAAM,IAAI,KAAK,CAAC,iFAAiF,QAAQ,EAAE,CAAC,CAAC;AAC/G,CAAC;AAED,6EAA6E;AAC7E,IAAI,YAAgC,CAAC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,GAAG,KAAe;IAClD,8EAA8E;IAC9E,sBAAsB;IACtB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,mBAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\n\n/**\n * Walk up the directory tree from startDir until a directory that contains\n * both a `package.json` and a `statics` folder is found. Stopping at the\n * package-root boundary avoids the risk of matching an unrelated `statics/`\n * folder higher up the filesystem.\n */\nfunction resolveStaticsPath(startDir: string): string {\n let dir = startDir;\n while (true) {\n if (existsSync(path.join(dir, 'statics')) && existsSync(path.join(dir, 'package.json'))) {\n return path.join(dir, 'statics');\n }\n const parent = path.dirname(dir);\n // Guard: filesystem root reached before finding a package boundary — unreachable in practice.\n /* v8 ignore next 3 */\n if (parent === dir) {\n break;\n }\n dir = parent;\n }\n // Guard: statics not found even after reaching the filesystem root — unreachable in practice.\n /* v8 ignore next */\n throw new Error(`Cannot locate statics/ directory (with co-located package.json) starting from ${startDir}`);\n}\n\n// Resolved on demand after the package entry point calls _initStaticsRoot().\nlet _staticsPath: string | undefined;\n\n/**\n * Initialises the statics root from the directory of the package entry point.\n * Must be called before any test fixture helpers are invoked.\n *\n * The package entry points (index.ts for ESM, index.cts for CJS) call this\n * with their own `path.dirname(fileURLToPath(import.meta.url))` or `__dirname`\n * respectively, so this module contains no module-system-specific syntax and\n * compiles correctly under both `module: NodeNext` and `module: CommonJS`.\n *\n * Design note — eager-init vs lazy resolution:\n * An alternative would be to resolve the statics path lazily inside\n * getStaticFilePath() on first call (eliminating _initStaticsRoot and the\n * entry-point coupling entirely). Eager-init was chosen instead because lazy\n * resolution cannot safely use import.meta.url in a CommonJS build, and\n * __dirname is not available in an ESM build. The entry-point side-effect\n * approach lets this module stay free of module-system-specific syntax while\n * still capturing the correct anchor directory at load time.\n * @internal\n */\nexport function _initStaticsRoot(dir: string): void {\n _staticsPath = resolveStaticsPath(dir);\n}\n\n/**\n * Resolve a path relative to the test-utils statics directory.\n * @param paths - Path segments to join after the statics root.\n * @returns The absolute path to the static fixture.\n */\nexport function getStaticFilePath(...paths: string[]): string {\n // Guard: entry point must call _initStaticsRoot() before this helper is used.\n /* v8 ignore next 3 */\n if (!_staticsPath) {\n throw new Error('getStaticFilePath() called before the package entry point initialised the statics root');\n }\n return path.join(_staticsPath, ...paths);\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getStaticFilePath = void 0;
|
|
18
|
+
const utils_js_1 = require("./generators/utils.js");
|
|
19
|
+
// Initialise the statics root using __dirname (the directory of this compiled
|
|
20
|
+
// CJS file) so that the walk-up in utils.ts lands on the correct package root.
|
|
21
|
+
// This side-effect runs before any re-exported functions are called.
|
|
22
|
+
(0, utils_js_1._initStaticsRoot)(__dirname);
|
|
23
|
+
__exportStar(require("./matchers/toEqualParsedQuery.js"), exports);
|
|
24
|
+
__exportStar(require("./matchers/vitest.js"), exports);
|
|
25
|
+
__exportStar(require("./generators/generators.js"), exports);
|
|
26
|
+
__exportStar(require("./generators/algebraGenerators.js"), exports);
|
|
27
|
+
var utils_js_2 = require("./generators/utils.js");
|
|
28
|
+
Object.defineProperty(exports, "getStaticFilePath", { enumerable: true, get: function () { return utils_js_2.getStaticFilePath; } });
|
|
29
|
+
__exportStar(require("./Sparql11NotesTest.js"), exports);
|
|
30
|
+
__exportStar(require("./fileUtils.js"), exports);
|
|
31
|
+
//# sourceMappingURL=indexCjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexCjs.js","sourceRoot":"","sources":["../../../lib/indexCjs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAyD;AAEzD,8EAA8E;AAC9E,+EAA+E;AAC/E,qEAAqE;AACrE,IAAA,2BAAgB,EAAC,SAAS,CAAC,CAAC;AAE5B,mEAAiD;AACjD,uDAAqC;AACrC,6DAA2C;AAC3C,oEAAkD;AAClD,kDAA0D;AAAjD,6GAAA,iBAAiB,OAAA;AAC1B,yDAAuC;AACvC,iDAA+B","sourcesContent":["import { _initStaticsRoot } from './generators/utils.js';\n\n// Initialise the statics root using __dirname (the directory of this compiled\n// CJS file) so that the walk-up in utils.ts lands on the correct package root.\n// This side-effect runs before any re-exported functions are called.\n_initStaticsRoot(__dirname);\n\nexport * from './matchers/toEqualParsedQuery.js';\nexport * from './matchers/vitest.js';\nexport * from './generators/generators.js';\nexport * from './generators/algebraGenerators.js';\nexport { getStaticFilePath } from './generators/utils.js';\nexport * from './Sparql11NotesTest.js';\nexport * from './fileUtils.js';\n"]}
|
|
@@ -3,16 +3,32 @@ import { lstatSync, readdirSync } from 'node:fs';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { readFile, readFileSync } from '../fileUtils.js';
|
|
5
5
|
import { getStaticFilePath } from './utils.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
// Computed lazily inside each generator so that getStaticFilePath() is not
|
|
7
|
+
// called at module-evaluation time. This avoids an ESM initialisation-order
|
|
8
|
+
// issue where algebraGenerators.js would execute before index.ts has had a
|
|
9
|
+
// chance to call _initStaticsRoot().
|
|
10
|
+
function getRootDir() {
|
|
11
|
+
return getStaticFilePath('algebra');
|
|
12
|
+
}
|
|
13
|
+
function getRootSparql() {
|
|
14
|
+
return join(getRootDir(), 'sparql');
|
|
15
|
+
}
|
|
16
|
+
function getRootJson() {
|
|
17
|
+
return join(getRootDir(), 'algebra');
|
|
18
|
+
}
|
|
19
|
+
function getRootJsonBlankToVariable() {
|
|
20
|
+
return join(getRootDir(), 'algebra-blank-to-var');
|
|
21
|
+
}
|
|
22
|
+
function getRootCanonicalSparql() {
|
|
23
|
+
return join(getRootDir(), 'canonical-sparql', 'base');
|
|
24
|
+
}
|
|
25
|
+
function getRootCanonicalSparqlBlankToVar() {
|
|
26
|
+
return join(getRootDir(), 'canonical-sparql', 'blank-to-var');
|
|
27
|
+
}
|
|
12
28
|
export function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
13
29
|
// Relative path starting from roots declared above.
|
|
14
30
|
function* subGen(relativePath) {
|
|
15
|
-
const absolutePath = join(blankToVariable ?
|
|
31
|
+
const absolutePath = join(blankToVariable ? getRootJsonBlankToVariable() : getRootJson(), relativePath);
|
|
16
32
|
if (lstatSync(absolutePath).isDirectory()) {
|
|
17
33
|
// Recursion
|
|
18
34
|
for (const sub of readdirSync(absolutePath)) {
|
|
@@ -21,8 +37,8 @@ export function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
21
37
|
}
|
|
22
38
|
else {
|
|
23
39
|
const name = relativePath.replace(/\.json$/u, '');
|
|
24
|
-
const sparqlPath = join(
|
|
25
|
-
const canonicalSparqlPath = join(blankToVariable ?
|
|
40
|
+
const sparqlPath = join(getRootSparql(), relativePath.replace(/\.json/u, '.sparql'));
|
|
41
|
+
const canonicalSparqlPath = join(blankToVariable ? getRootCanonicalSparqlBlankToVar() : getRootCanonicalSparql(), relativePath.replace(/\.json/u, '.sparql'));
|
|
26
42
|
yield {
|
|
27
43
|
name,
|
|
28
44
|
json: JSON.parse(readFileSync(absolutePath)),
|
|
@@ -32,7 +48,7 @@ export function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
32
48
|
};
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
|
-
const subfolders = readdirSync(blankToVariable ?
|
|
51
|
+
const subfolders = readdirSync(blankToVariable ? getRootJsonBlankToVariable() : getRootJson());
|
|
36
52
|
if (subfolders.includes(suite)) {
|
|
37
53
|
yield* subGen(suite);
|
|
38
54
|
}
|
|
@@ -43,7 +59,7 @@ export function* sparqlAlgebraTests(suite, blankToVariable, getSPARQL) {
|
|
|
43
59
|
*/
|
|
44
60
|
export function* sparqlQueries(suite) {
|
|
45
61
|
function* subGen(relativePath) {
|
|
46
|
-
const absolutePath = join(
|
|
62
|
+
const absolutePath = join(getRootSparql(), relativePath);
|
|
47
63
|
if (lstatSync(absolutePath).isDirectory()) {
|
|
48
64
|
// Recursion
|
|
49
65
|
for (const sub of readdirSync(absolutePath)) {
|
|
@@ -59,7 +75,7 @@ export function* sparqlQueries(suite) {
|
|
|
59
75
|
};
|
|
60
76
|
}
|
|
61
77
|
}
|
|
62
|
-
const subfolders = readdirSync(
|
|
78
|
+
const subfolders = readdirSync(getRootSparql());
|
|
63
79
|
if (subfolders.includes(suite)) {
|
|
64
80
|
yield* subGen(suite);
|
|
65
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraGenerators.js","sourceRoot":"","sources":["../../../../lib/generators/algebraGenerators.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"algebraGenerators.js","sourceRoot":"","sources":["../../../../lib/generators/algebraGenerators.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,qCAAqC;AACrC,SAAS,UAAU;IACjB,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,aAAa;IACpB,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,WAAW;IAClB,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,SAAS,CAAC,CAAC;AACvC,CAAC;AACD,SAAS,0BAA0B;IACjC,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC;AACpD,CAAC;AACD,SAAS,sBAAsB;IAC7B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AACD,SAAS,gCAAgC;IACvC,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,kBA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AAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAID;;;;;GAKG;AACH,MAAM,SAAS,CAAC,CAAC,0BAA0B,CACzC,KAA2B,EAC3B,MAAkC;IAElC,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC9D,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;YACnD,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM;YACJ,IAAI;YACJ,OAAO,EAAE,KAAK,IAAG,EAAE;gBACjB,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;gBACpD,OAAO;oBACL,KAAK;iBACN,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport { lstatSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { readFile, readFileSync } from '../fileUtils.js';\nimport type { NegativeTest } from './generators.js';\nimport { getStaticFilePath } from './utils.js';\n\n// Computed lazily inside each generator so that getStaticFilePath() is not\n// called at module-evaluation time. This avoids an ESM initialisation-order\n// issue where algebraGenerators.js would execute before index.ts has had a\n// chance to call _initStaticsRoot().\nfunction getRootDir(): string {\n return getStaticFilePath('algebra');\n}\nfunction getRootSparql(): string {\n return join(getRootDir(), 'sparql');\n}\nfunction getRootJson(): string {\n return join(getRootDir(), 'algebra');\n}\nfunction getRootJsonBlankToVariable(): string {\n return join(getRootDir(), 'algebra-blank-to-var');\n}\nfunction getRootCanonicalSparql(): string {\n return join(getRootDir(), 'canonical-sparql', 'base');\n}\nfunction getRootCanonicalSparqlBlankToVar(): string {\n return join(getRootDir(), 'canonical-sparql', 'blank-to-var');\n}\n\nexport interface algebraTestGen {\n name: string;\n json: unknown;\n quads: boolean;\n sparql: string | undefined;\n canonicalSparql: string | undefined;\n}\n\nexport type AlgebraTestSuite = 'dawg-syntax' | 'sparql-1.1' | 'sparql11-query' | 'sparql12';\n\n/**\n * Yields algebra-level test cases from the static test fixtures.\n * Each test provides a SPARQL query, expected algebra JSON, and optionally a canonical SPARQL string.\n * @param suite - The test suite to iterate.\n * @param blankToVariable - Whether to use the blank-to-variable fixture variant.\n * @param getSPARQL - Whether to load the SPARQL and canonical SPARQL strings.\n */\nexport function sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: true):\nGenerator<algebraTestGen & { sparql: string; canonicalSparql: string }>;\nexport function sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen>;\nexport function* sparqlAlgebraTests(suite: AlgebraTestSuite, blankToVariable: boolean, getSPARQL: boolean):\nGenerator<algebraTestGen> {\n // Relative path starting from roots declared above.\n function* subGen(relativePath: string): Generator<algebraTestGen> {\n const absolutePath = join(blankToVariable ? getRootJsonBlankToVariable() : getRootJson(), relativePath);\n if (lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of readdirSync(absolutePath)) {\n yield* subGen(join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.json$/u, '');\n const sparqlPath = join(getRootSparql(), relativePath.replace(/\\.json/u, '.sparql'));\n const canonicalSparqlPath = join(\n blankToVariable ? getRootCanonicalSparqlBlankToVar() : getRootCanonicalSparql(),\n relativePath.replace(/\\.json/u, '.sparql'),\n );\n yield {\n name,\n json: JSON.parse(readFileSync(absolutePath)),\n sparql: getSPARQL ? readFileSync(sparqlPath, 'utf8') : undefined,\n canonicalSparql: getSPARQL ? readFileSync(canonicalSparqlPath, 'utf-8') : undefined,\n quads: name.endsWith('-quads'),\n };\n }\n }\n\n const subfolders = readdirSync(blankToVariable ? getRootJsonBlankToVariable() : getRootJson());\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n\ntype GenQuery = { query: string; name: string };\n/**\n * Yields raw SPARQL query strings from the static test fixtures for a given suite.\n * @param suite - The test suite to iterate.\n */\nexport function* sparqlQueries(suite: AlgebraTestSuite): Generator<GenQuery> {\n function* subGen(relativePath: string): Generator<GenQuery> {\n const absolutePath = join(getRootSparql(), relativePath);\n if (lstatSync(absolutePath).isDirectory()) {\n // Recursion\n for (const sub of readdirSync(absolutePath)) {\n yield* subGen(join(relativePath, sub));\n }\n } else {\n const name = relativePath.replace(/\\.sparql$/u, '');\n const content = readFileSync(absolutePath, 'utf-8');\n yield {\n name,\n query: content.replaceAll(/\\r?\\n/gu, '\\n'),\n };\n }\n }\n\n const subfolders = readdirSync(getRootSparql());\n if (subfolders.includes(suite)) {\n yield* subGen(suite);\n }\n}\n\nexport type NegativeAlgebraSuite = 'sparql-1.1-negative' | 'sparql-1.2-negative';\n\n/**\n * Yields test cases for negative (invalid) algebra-level tests.\n * Each test provides a SPARQL query that should fail during algebra transformation.\n * @param suite - The negative test suite to iterate.\n * @param filter - Optional filter predicate applied to the test file name.\n */\nexport function* sparqlAlgebraNegativeTests(\n suite: NegativeAlgebraSuite,\n filter?: (name: string) => boolean,\n): Generator<NegativeTest> {\n const astDir = getStaticFilePath('algebra');\n const sparqlDir = join(astDir, 'sparql', suite);\n const statics = readdirSync(sparqlDir);\n for (const file of statics.filter(f => f.endsWith('.sparql'))) {\n if (filter && !filter(file.replace('.sparql', ''))) {\n continue;\n }\n const name = file.replace(/\\.sparql$/u, '');\n yield {\n name,\n statics: async() => {\n const query = await readFile(join(sparqlDir, file));\n return {\n query,\n };\n },\n };\n }\n}\n"]}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialises the statics root from the directory of the package entry point.
|
|
3
|
+
* Must be called before any test fixture helpers are invoked.
|
|
4
|
+
*
|
|
5
|
+
* The package entry points (index.ts for ESM, index.cts for CJS) call this
|
|
6
|
+
* with their own `path.dirname(fileURLToPath(import.meta.url))` or `__dirname`
|
|
7
|
+
* respectively, so this module contains no module-system-specific syntax and
|
|
8
|
+
* compiles correctly under both `module: NodeNext` and `module: CommonJS`.
|
|
9
|
+
*
|
|
10
|
+
* Design note — eager-init vs lazy resolution:
|
|
11
|
+
* An alternative would be to resolve the statics path lazily inside
|
|
12
|
+
* getStaticFilePath() on first call (eliminating _initStaticsRoot and the
|
|
13
|
+
* entry-point coupling entirely). Eager-init was chosen instead because lazy
|
|
14
|
+
* resolution cannot safely use import.meta.url in a CommonJS build, and
|
|
15
|
+
* __dirname is not available in an ESM build. The entry-point side-effect
|
|
16
|
+
* approach lets this module stay free of module-system-specific syntax while
|
|
17
|
+
* still capturing the correct anchor directory at load time.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function _initStaticsRoot(dir: string): void;
|
|
1
21
|
/**
|
|
2
22
|
* Resolve a path relative to the test-utils statics directory.
|
|
3
23
|
* @param paths - Path segments to join after the statics root.
|
|
@@ -1,14 +1,65 @@
|
|
|
1
1
|
/* eslint-disable import/no-nodejs-modules */
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Walk up the directory tree from startDir until a directory that contains
|
|
6
|
+
* both a `package.json` and a `statics` folder is found. Stopping at the
|
|
7
|
+
* package-root boundary avoids the risk of matching an unrelated `statics/`
|
|
8
|
+
* folder higher up the filesystem.
|
|
9
|
+
*/
|
|
10
|
+
function resolveStaticsPath(startDir) {
|
|
11
|
+
let dir = startDir;
|
|
12
|
+
while (true) {
|
|
13
|
+
if (existsSync(path.join(dir, 'statics')) && existsSync(path.join(dir, 'package.json'))) {
|
|
14
|
+
return path.join(dir, 'statics');
|
|
15
|
+
}
|
|
16
|
+
const parent = path.dirname(dir);
|
|
17
|
+
// Guard: filesystem root reached before finding a package boundary — unreachable in practice.
|
|
18
|
+
/* v8 ignore next 3 */
|
|
19
|
+
if (parent === dir) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
// Guard: statics not found even after reaching the filesystem root — unreachable in practice.
|
|
25
|
+
/* v8 ignore next */
|
|
26
|
+
throw new Error(`Cannot locate statics/ directory (with co-located package.json) starting from ${startDir}`);
|
|
27
|
+
}
|
|
28
|
+
// Resolved on demand after the package entry point calls _initStaticsRoot().
|
|
29
|
+
let _staticsPath;
|
|
30
|
+
/**
|
|
31
|
+
* Initialises the statics root from the directory of the package entry point.
|
|
32
|
+
* Must be called before any test fixture helpers are invoked.
|
|
33
|
+
*
|
|
34
|
+
* The package entry points (index.ts for ESM, index.cts for CJS) call this
|
|
35
|
+
* with their own `path.dirname(fileURLToPath(import.meta.url))` or `__dirname`
|
|
36
|
+
* respectively, so this module contains no module-system-specific syntax and
|
|
37
|
+
* compiles correctly under both `module: NodeNext` and `module: CommonJS`.
|
|
38
|
+
*
|
|
39
|
+
* Design note — eager-init vs lazy resolution:
|
|
40
|
+
* An alternative would be to resolve the statics path lazily inside
|
|
41
|
+
* getStaticFilePath() on first call (eliminating _initStaticsRoot and the
|
|
42
|
+
* entry-point coupling entirely). Eager-init was chosen instead because lazy
|
|
43
|
+
* resolution cannot safely use import.meta.url in a CommonJS build, and
|
|
44
|
+
* __dirname is not available in an ESM build. The entry-point side-effect
|
|
45
|
+
* approach lets this module stay free of module-system-specific syntax while
|
|
46
|
+
* still capturing the correct anchor directory at load time.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export function _initStaticsRoot(dir) {
|
|
50
|
+
_staticsPath = resolveStaticsPath(dir);
|
|
51
|
+
}
|
|
6
52
|
/**
|
|
7
53
|
* Resolve a path relative to the test-utils statics directory.
|
|
8
54
|
* @param paths - Path segments to join after the statics root.
|
|
9
55
|
* @returns The absolute path to the static fixture.
|
|
10
56
|
*/
|
|
11
57
|
export function getStaticFilePath(...paths) {
|
|
12
|
-
|
|
58
|
+
// Guard: entry point must call _initStaticsRoot() before this helper is used.
|
|
59
|
+
/* v8 ignore next 3 */
|
|
60
|
+
if (!_staticsPath) {
|
|
61
|
+
throw new Error('getStaticFilePath() called before the package entry point initialised the statics root');
|
|
62
|
+
}
|
|
63
|
+
return path.join(_staticsPath, ...paths);
|
|
13
64
|
}
|
|
14
65
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/generators/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/generators/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,QAAgB;IAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACxF,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,8FAA8F;QAC9F,sBAAsB;QACtB,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM;QACR,CAAC;QACD,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,8FAA8F;IAC9F,oBAAoB;IACpB,MAAM,IAAI,KAAK,CAAC,iFAAiF,QAAQ,EAAE,CAAC,CAAC;AAC/G,CAAC;AAED,6EAA6E;AAC7E,IAAI,YAAgC,CAAC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAG,KAAe;IAClD,8EAA8E;IAC9E,sBAAsB;IACtB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\n\n/**\n * Walk up the directory tree from startDir until a directory that contains\n * both a `package.json` and a `statics` folder is found. Stopping at the\n * package-root boundary avoids the risk of matching an unrelated `statics/`\n * folder higher up the filesystem.\n */\nfunction resolveStaticsPath(startDir: string): string {\n let dir = startDir;\n while (true) {\n if (existsSync(path.join(dir, 'statics')) && existsSync(path.join(dir, 'package.json'))) {\n return path.join(dir, 'statics');\n }\n const parent = path.dirname(dir);\n // Guard: filesystem root reached before finding a package boundary — unreachable in practice.\n /* v8 ignore next 3 */\n if (parent === dir) {\n break;\n }\n dir = parent;\n }\n // Guard: statics not found even after reaching the filesystem root — unreachable in practice.\n /* v8 ignore next */\n throw new Error(`Cannot locate statics/ directory (with co-located package.json) starting from ${startDir}`);\n}\n\n// Resolved on demand after the package entry point calls _initStaticsRoot().\nlet _staticsPath: string | undefined;\n\n/**\n * Initialises the statics root from the directory of the package entry point.\n * Must be called before any test fixture helpers are invoked.\n *\n * The package entry points (index.ts for ESM, index.cts for CJS) call this\n * with their own `path.dirname(fileURLToPath(import.meta.url))` or `__dirname`\n * respectively, so this module contains no module-system-specific syntax and\n * compiles correctly under both `module: NodeNext` and `module: CommonJS`.\n *\n * Design note — eager-init vs lazy resolution:\n * An alternative would be to resolve the statics path lazily inside\n * getStaticFilePath() on first call (eliminating _initStaticsRoot and the\n * entry-point coupling entirely). Eager-init was chosen instead because lazy\n * resolution cannot safely use import.meta.url in a CommonJS build, and\n * __dirname is not available in an ESM build. The entry-point side-effect\n * approach lets this module stay free of module-system-specific syntax while\n * still capturing the correct anchor directory at load time.\n * @internal\n */\nexport function _initStaticsRoot(dir: string): void {\n _staticsPath = resolveStaticsPath(dir);\n}\n\n/**\n * Resolve a path relative to the test-utils statics directory.\n * @param paths - Path segments to join after the statics root.\n * @returns The absolute path to the static fixture.\n */\nexport function getStaticFilePath(...paths: string[]): string {\n // Guard: entry point must call _initStaticsRoot() before this helper is used.\n /* v8 ignore next 3 */\n if (!_staticsPath) {\n throw new Error('getStaticFilePath() called before the package entry point initialised the statics root');\n }\n return path.join(_staticsPath, ...paths);\n}\n"]}
|
package/dist/esm/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export * from './matchers/toEqualParsedQuery.js';
|
|
|
2
2
|
export * from './matchers/vitest.js';
|
|
3
3
|
export * from './generators/generators.js';
|
|
4
4
|
export * from './generators/algebraGenerators.js';
|
|
5
|
-
export
|
|
5
|
+
export { getStaticFilePath } from './generators/utils.js';
|
|
6
6
|
export * from './Sparql11NotesTest.js';
|
|
7
7
|
export * from './fileUtils.js';
|
package/dist/esm/lib/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
/* eslint-disable import/no-nodejs-modules */
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { _initStaticsRoot } from './generators/utils.js';
|
|
5
|
+
// Initialise the statics root using this file's own location so that the
|
|
6
|
+
// walk-up in utils.ts lands on the correct package root regardless of the
|
|
7
|
+
// install depth. This side-effect runs before any of the re-exported
|
|
8
|
+
// functions are called by consuming tests.
|
|
9
|
+
_initStaticsRoot(path.dirname(fileURLToPath(import.meta.url)));
|
|
1
10
|
export * from './matchers/toEqualParsedQuery.js';
|
|
2
11
|
export * from './matchers/vitest.js';
|
|
3
12
|
export * from './generators/generators.js';
|
|
4
13
|
export * from './generators/algebraGenerators.js';
|
|
5
|
-
export
|
|
14
|
+
export { getStaticFilePath } from './generators/utils.js';
|
|
6
15
|
export * from './Sparql11NotesTest.js';
|
|
7
16
|
export * from './fileUtils.js';
|
|
8
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,2CAA2C;AAC3C,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC","sourcesContent":["/* eslint-disable import/no-nodejs-modules */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { _initStaticsRoot } from './generators/utils.js';\n\n// Initialise the statics root using this file's own location so that the\n// walk-up in utils.ts lands on the correct package root regardless of the\n// install depth. This side-effect runs before any of the re-exported\n// functions are called by consuming tests.\n_initStaticsRoot(path.dirname(fileURLToPath(import.meta.url)));\n\nexport * from './matchers/toEqualParsedQuery.js';\nexport * from './matchers/vitest.js';\nexport * from './generators/generators.js';\nexport * from './generators/algebraGenerators.js';\nexport { getStaticFilePath } from './generators/utils.js';\nexport * from './Sparql11NotesTest.js';\nexport * from './fileUtils.js';\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traqula/test-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.5",
|
|
5
5
|
"description": "Test utils used by the Traqula monorepo",
|
|
6
6
|
"lsd:module": true,
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/comunica/traqula/issues"
|
|
15
15
|
},
|
|
16
|
-
"sideEffects":
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"**/index.js",
|
|
18
|
+
"**/indexCjs.js"
|
|
19
|
+
],
|
|
17
20
|
"publishConfig": {
|
|
18
21
|
"access": "public"
|
|
19
22
|
},
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
".": {
|
|
23
26
|
"types": "./dist/esm/lib/index.d.ts",
|
|
24
27
|
"import": "./dist/esm/lib/index.js",
|
|
25
|
-
"require": "./dist/cjs/lib/
|
|
28
|
+
"require": "./dist/cjs/lib/indexCjs.js"
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
"main": "dist/esm/lib/index.js",
|
|
@@ -49,5 +52,5 @@
|
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@rdfjs/types": "^2.0.0"
|
|
51
54
|
},
|
|
52
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ca24949dfd7d4b01c42b1c6fdc2d1f70fbee08af"
|
|
53
56
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "project",
|
|
3
|
+
"input": {
|
|
4
|
+
"type": "bgp",
|
|
5
|
+
"patterns": [
|
|
6
|
+
{
|
|
7
|
+
"type": "pattern",
|
|
8
|
+
"termType": "Quad",
|
|
9
|
+
"subject": {
|
|
10
|
+
"termType": "NamedNode",
|
|
11
|
+
"value": "http://example/abc"
|
|
12
|
+
},
|
|
13
|
+
"predicate": {
|
|
14
|
+
"termType": "Variable",
|
|
15
|
+
"value": "p"
|
|
16
|
+
},
|
|
17
|
+
"object": {
|
|
18
|
+
"termType": "Variable",
|
|
19
|
+
"value": "o"
|
|
20
|
+
},
|
|
21
|
+
"graph": {
|
|
22
|
+
"termType": "DefaultGraph",
|
|
23
|
+
"value": ""
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"variables": [
|
|
29
|
+
{
|
|
30
|
+
"termType": "Variable",
|
|
31
|
+
"value": "o"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"termType": "Variable",
|
|
35
|
+
"value": "p"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|