@malloydata/malloy-tests 0.0.271-whscullin-pinning-250430202557 → 0.0.272

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/package.json CHANGED
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@jest/globals": "^29.4.3",
24
- "@malloydata/db-bigquery": "0.0.271-whscullin-pinning-250430202557",
25
- "@malloydata/db-duckdb": "0.0.271-whscullin-pinning-250430202557",
26
- "@malloydata/db-postgres": "0.0.271-whscullin-pinning-250430202557",
27
- "@malloydata/db-snowflake": "0.0.271-whscullin-pinning-250430202557",
28
- "@malloydata/db-trino": "0.0.271-whscullin-pinning-250430202557",
29
- "@malloydata/malloy": "0.0.271-whscullin-pinning-250430202557",
30
- "@malloydata/malloy-tag": "0.0.271-whscullin-pinning-250430202557",
31
- "@malloydata/render": "0.0.271-whscullin-pinning-250430202557",
24
+ "@malloydata/db-bigquery": "0.0.272",
25
+ "@malloydata/db-duckdb": "0.0.272",
26
+ "@malloydata/db-postgres": "0.0.272",
27
+ "@malloydata/db-snowflake": "0.0.272",
28
+ "@malloydata/db-trino": "0.0.272",
29
+ "@malloydata/malloy": "0.0.272",
30
+ "@malloydata/malloy-tag": "0.0.272",
31
+ "@malloydata/render": "0.0.272",
32
32
  "events": "^3.3.0",
33
33
  "jsdom": "^22.1.0",
34
34
  "luxon": "^2.4.0",
@@ -38,5 +38,5 @@
38
38
  "@types/jsdom": "^21.1.1",
39
39
  "@types/luxon": "^2.4.0"
40
40
  },
41
- "version": "0.0.271-whscullin-pinning-250430202557"
41
+ "version": "0.0.272"
42
42
  }
@@ -345,4 +345,20 @@ describe('parameters', () => {
345
345
  `
346
346
  ).malloyResultMatches(runtime, {param_value: 10});
347
347
  });
348
+ // TODO fix this when we redo namespaces
349
+ it.skip('default value not passed through extension propagates, with composite source', async () => {
350
+ await expect(
351
+ `
352
+ ##! experimental { parameters composite_sources }
353
+ source: ab_new(param::number is 10) is compose(
354
+ duckdb.table('malloytest.state_facts'),
355
+ duckdb.table('malloytest.state_facts') extend { dimension: foo is 1 }
356
+ ) extend {
357
+ dimension: param_value is param
358
+ }
359
+ source: ab_new_new is ab_new extend {}
360
+ run: ab_new_new -> { group_by: param_value, foo }
361
+ `
362
+ ).malloyResultMatches(runtime, {param_value: 10});
363
+ });
348
364
  });
@@ -448,4 +448,33 @@ describe.each(runtimes.runtimeList)('%s', (databaseName, runtime) => {
448
448
  run: x(param is 2) -> { group_by: b }
449
449
  `).malloyResultMatches(wrappedRuntime, {b: 3});
450
450
  });
451
+ it('nested composite where field usage depends on which composite selected', async () => {
452
+ await expect(`
453
+ ##! experimental.composite_sources
454
+ source: state_facts is ${databaseName}.table('malloytest.state_facts')
455
+ source: x is compose(
456
+ compose(
457
+ state_facts extend {
458
+ dimension: a is 'a1'
459
+ },
460
+ state_facts extend {
461
+ dimension: b is 'b1'
462
+ }
463
+ ) extend {
464
+ dimension: x is b
465
+ },
466
+ compose(
467
+ state_facts extend {
468
+ dimension: a is 'a2'
469
+ },
470
+ state_facts extend {
471
+ dimension: b is 'b2'
472
+ }
473
+ ) extend {
474
+ dimension: x is b
475
+ }
476
+ )
477
+ run: x -> { group_by: x }
478
+ `).malloyResultMatches(runtime, {x: 'b1'});
479
+ });
451
480
  });
@@ -579,13 +579,9 @@ describe.each(runtimes.runtimeList)(
579
579
  test('nest a group_by repeated record', async () => {
580
580
  await expect(`
581
581
  run: ${conName}.sql(""" ${selectAB('ab')} """)
582
- -> {
583
- nest: gab is {group_by: ab }
584
- } -> {
585
- // mtoy todo fix malloyResultMatches, this un-nest should not be needed
586
- select: gab.ab
587
- }
588
- `).malloyResultMatches(runtime, {ab: ab_eq});
582
+ -> { nest: gab is {group_by: ab } }
583
+ -> { select: gab.ab }
584
+ `).matchesRows(runtime, {ab: ab_eq});
589
585
  });
590
586
  });
591
587
  }
@@ -28,6 +28,7 @@ import {databasesFromEnvironmentOr} from '../../util';
28
28
  import '../../util/db-jest-matchers';
29
29
 
30
30
  const runtimes = new RuntimeList(databasesFromEnvironmentOr(allDatabases));
31
+
31
32
  function modelText(connectionName: string) {
32
33
  return `
33
34
  source: aircraft_models is ${connectionName}.table('malloytest.aircraft_models') extend {
@@ -41,6 +41,18 @@ interface QueryRunResult {
41
41
  queryTestTag: Tag;
42
42
  }
43
43
 
44
+ function errInfo(e: {message?: string; stack?: string}) {
45
+ let err = '';
46
+ const trace = e.stack ?? '';
47
+ if (e.message && !trace.includes(e.message)) {
48
+ err = `ERROR: ${e.message}\n`;
49
+ }
50
+ if (e.stack) {
51
+ err += `STACK: ${e.stack}\n`;
52
+ }
53
+ return err;
54
+ }
55
+
44
56
  export async function runQuery(
45
57
  tq: TestQuery
46
58
  ): Promise<Partial<QueryRunResult>> {
@@ -60,7 +72,7 @@ export async function runQuery(
60
72
  fail: {
61
73
  pass: false,
62
74
  message: () =>
63
- `Could not prepare query to run: ${e.message}\n\nQUERY:\n${queryText}`,
75
+ `Could not prepare query to run:\n${queryText}\n\n${errInfo(e)}`,
64
76
  },
65
77
  };
66
78
  }
@@ -78,13 +90,11 @@ export async function runQuery(
78
90
  )}`;
79
91
  } else {
80
92
  try {
81
- failMsg += `\nMESSAGE: ${e.message}\nSQL: ${await query.getSQL()}\n`;
93
+ failMsg += `\nSQL: ${await query.getSQL()}\n`;
82
94
  } catch (e2) {
83
95
  failMsg += '\nSQL FOR QUERY COULD NOT BE COMPUTED\n';
84
96
  }
85
- if (e.stack) {
86
- failMsg += `STACK:\n${e.stack}\n`;
87
- }
97
+ failMsg += errInfo(e);
88
98
  }
89
99
  return {fail: {pass: false, message: () => failMsg}, query};
90
100
  }