@malloydata/malloy 0.0.190 → 0.0.191-dev240925232958

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.
Files changed (90) hide show
  1. package/dist/lang/ast/expressions/constant-expression.js +4 -1
  2. package/dist/lang/ast/expressions/expr-aggregate-function.js +25 -14
  3. package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -3
  4. package/dist/lang/ast/expressions/expr-cast.js +1 -1
  5. package/dist/lang/ast/expressions/expr-coalesce.js +1 -1
  6. package/dist/lang/ast/expressions/expr-func.js +20 -31
  7. package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
  8. package/dist/lang/ast/expressions/expr-id-reference.js +1 -3
  9. package/dist/lang/ast/expressions/expr-props.js +8 -8
  10. package/dist/lang/ast/expressions/expr-time-extract.js +7 -13
  11. package/dist/lang/ast/expressions/expr-ungroup.js +4 -8
  12. package/dist/lang/ast/expressions/for-range.js +2 -3
  13. package/dist/lang/ast/expressions/function-ordering.js +6 -6
  14. package/dist/lang/ast/expressions/partial-compare.js +1 -3
  15. package/dist/lang/ast/expressions/pick-when.js +30 -20
  16. package/dist/lang/ast/expressions/range.js +1 -1
  17. package/dist/lang/ast/expressions/top-by.js +1 -1
  18. package/dist/lang/ast/field-space/dynamic-space.js +1 -1
  19. package/dist/lang/ast/field-space/index-field-space.js +6 -6
  20. package/dist/lang/ast/field-space/parameter-space.js +14 -3
  21. package/dist/lang/ast/field-space/project-field-space.js +1 -1
  22. package/dist/lang/ast/field-space/query-spaces.d.ts +2 -1
  23. package/dist/lang/ast/field-space/query-spaces.js +7 -6
  24. package/dist/lang/ast/field-space/reference-field.js +1 -1
  25. package/dist/lang/ast/field-space/refined-space.js +3 -3
  26. package/dist/lang/ast/field-space/static-space.js +11 -2
  27. package/dist/lang/ast/parameters/has-parameter.js +4 -4
  28. package/dist/lang/ast/query-builders/index-builder.js +4 -4
  29. package/dist/lang/ast/query-builders/project-builder.js +2 -2
  30. package/dist/lang/ast/query-builders/reduce-builder.js +5 -5
  31. package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
  32. package/dist/lang/ast/query-elements/query-reference.js +2 -2
  33. package/dist/lang/ast/query-items/field-declaration.js +7 -4
  34. package/dist/lang/ast/query-items/field-references.js +1 -1
  35. package/dist/lang/ast/query-items/typecheck_utils.js +31 -11
  36. package/dist/lang/ast/query-properties/filters.js +4 -4
  37. package/dist/lang/ast/query-properties/ordering.js +3 -3
  38. package/dist/lang/ast/query-properties/qop-desc.js +2 -2
  39. package/dist/lang/ast/query-properties/top.js +5 -5
  40. package/dist/lang/ast/query-utils.js +1 -1
  41. package/dist/lang/ast/source-elements/named-source.d.ts +2 -2
  42. package/dist/lang/ast/source-elements/named-source.js +12 -13
  43. package/dist/lang/ast/source-elements/refined-source.js +9 -7
  44. package/dist/lang/ast/source-elements/sql-source.js +5 -5
  45. package/dist/lang/ast/source-elements/table-source.js +2 -2
  46. package/dist/lang/ast/source-properties/joins.js +6 -6
  47. package/dist/lang/ast/source-properties/renames.js +3 -3
  48. package/dist/lang/ast/source-query-elements/source-query-element.d.ts +2 -1
  49. package/dist/lang/ast/source-query-elements/source-query-element.js +3 -2
  50. package/dist/lang/ast/source-query-elements/sq-arrow.js +2 -2
  51. package/dist/lang/ast/source-query-elements/sq-extend.js +1 -1
  52. package/dist/lang/ast/source-query-elements/sq-reference.js +5 -5
  53. package/dist/lang/ast/source-query-elements/sq-refine.js +2 -2
  54. package/dist/lang/ast/source-query-elements/sq-source.js +1 -1
  55. package/dist/lang/ast/sql-elements/sql-string.js +2 -2
  56. package/dist/lang/ast/statements/define-query.js +2 -2
  57. package/dist/lang/ast/statements/define-source.js +3 -3
  58. package/dist/lang/ast/statements/import-statement.js +7 -7
  59. package/dist/lang/ast/struct-utils.js +1 -1
  60. package/dist/lang/ast/types/expression-def.js +21 -22
  61. package/dist/lang/ast/types/lookup-result.d.ts +5 -1
  62. package/dist/lang/ast/types/malloy-element.d.ts +8 -5
  63. package/dist/lang/ast/types/malloy-element.js +33 -27
  64. package/dist/lang/ast/view-elements/qop-desc-view.js +3 -3
  65. package/dist/lang/ast/view-elements/reference-view.js +6 -6
  66. package/dist/lang/ast/view-elements/refine-utils.js +6 -6
  67. package/dist/lang/ast/view-elements/view-arrow.js +1 -1
  68. package/dist/lang/ast/view-elements/view-refine.js +1 -1
  69. package/dist/lang/malloy-to-ast.d.ts +7 -7
  70. package/dist/lang/malloy-to-ast.js +56 -55
  71. package/dist/lang/parse-log.d.ts +323 -6
  72. package/dist/lang/parse-log.js +62 -16
  73. package/dist/lang/parse-malloy.d.ts +5 -3
  74. package/dist/lang/parse-malloy.js +22 -31
  75. package/dist/lang/test/annotation.spec.js +4 -4
  76. package/dist/lang/test/expressions.spec.js +93 -74
  77. package/dist/lang/test/imports.spec.js +5 -5
  78. package/dist/lang/test/lenses.spec.js +18 -18
  79. package/dist/lang/test/literals.spec.js +1 -1
  80. package/dist/lang/test/locations.spec.js +5 -5
  81. package/dist/lang/test/parameters.spec.js +34 -34
  82. package/dist/lang/test/parse-expects.d.ts +10 -28
  83. package/dist/lang/test/parse-expects.js +38 -33
  84. package/dist/lang/test/parse.spec.js +49 -49
  85. package/dist/lang/test/query.spec.js +82 -82
  86. package/dist/lang/test/source.spec.js +6 -6
  87. package/dist/lang/test/test-translator.d.ts +19 -0
  88. package/dist/lang/test/test-translator.js +20 -1
  89. package/dist/tags.js +4 -2
  90. package/package.json +1 -1
@@ -48,22 +48,22 @@ describe('model statements', () => {
48
48
  m.translator.update({
49
49
  errors: { tables: { 'a1:aTable': 'invalid connection' } },
50
50
  });
51
- expect(m).translationToFailWith('a1 is not a connection');
51
+ expect(m).toLog((0, test_translator_1.errorMessage)('a1 is not a connection'));
52
52
  });
53
53
  test('cannot refine table', () => {
54
- expect((0, test_translator_1.markSource) `run: \`_db_\`.table('aTable') + { limit: 10 }`).translationToFailWith('Cannot add view refinements to a source');
54
+ expect((0, test_translator_1.markSource) `run: \`_db_\`.table('aTable') + { limit: 10 }`).toLog((0, test_translator_1.errorMessage)('Cannot add view refinements to a source'));
55
55
  });
56
56
  test('table function is deprecated', () => {
57
57
  expect(`##! m4warnings=warn
58
58
  source: testA is table('_db_:aTable')
59
- `).toTranslateWithWarnings("`table('connection_name:table_path')` is deprecated; use `connection_name.table('table_path')`");
59
+ `).toLog((0, test_translator_1.warningMessage)("`table('connection_name:table_path')` is deprecated; use `connection_name.table('table_path')`"));
60
60
  });
61
61
  test('cannot run table', () => {
62
- expect((0, test_translator_1.markSource) `run: \`_db_\`.table('aTable')`).translationToFailWith('This source cannot be used as a query');
62
+ expect((0, test_translator_1.markSource) `run: \`_db_\`.table('aTable')`).toLog((0, test_translator_1.errorMessage)('This source cannot be used as a query'));
63
63
  });
64
64
  });
65
65
  test('errors on redefinition of query', () => {
66
- expect('query: q1 is a -> { select: * }, q1 is a -> { select: * }').translationToFailWith("'q1' is already defined, cannot redefine");
66
+ expect('query: q1 is a -> { select: * }, q1 is a -> { select: * }').toLog((0, test_translator_1.errorMessage)("'q1' is already defined, cannot redefine"));
67
67
  });
68
68
  test('##! experimental enables all experiments', () => {
69
69
  expect('##! experimental\n;;[ "x" ]').toTranslate();
@@ -72,13 +72,19 @@ describe('model statements', () => {
72
72
  expect('##! experimental { compilerTestExperimentParse compilerTestExperimentTranslate }\n;;[ "x" ]').toTranslate();
73
73
  });
74
74
  test('experiments do not bleed into one another', () => {
75
- expect('##! experimental { this_experiment_does_not_exist }\n;;[ "x" ]').translationToFailWith("Experimental flag 'compilerTestExperimentParse' required to enable this feature");
75
+ expect('##! experimental { this_experiment_does_not_exist }\n;;[ "x" ]').toLog((0, test_translator_1.error)('experiment-not-enabled', {
76
+ experimentId: 'compilerTestExperimentParse',
77
+ }));
76
78
  });
77
79
  test('experiment failures in parse are flagged', () => {
78
- expect(';;[ "x" ]').translationToFailWith("Experimental flag 'compilerTestExperimentParse' required to enable this feature");
80
+ expect(';;[ "x" ]').toLog((0, test_translator_1.error)('experiment-not-enabled', {
81
+ experimentId: 'compilerTestExperimentParse',
82
+ }));
79
83
  });
80
84
  test('experiment failures in second pass are flagged', () => {
81
- expect('##! experimental.compilerTestExperimentParse\n;;[ "x" ]').translationToFailWith("Experimental flag 'compilerTestExperimentTranslate' is not set, feature not available");
85
+ expect('##! experimental.compilerTestExperimentParse\n;;[ "x" ]').toLog((0, test_translator_1.error)('experiment-not-enabled', {
86
+ experimentId: 'compilerTestExperimentTranslate',
87
+ }));
82
88
  });
83
89
  });
84
90
  describe('error handling', () => {
@@ -87,7 +93,7 @@ describe('error handling', () => {
87
93
  source: flights is _db_.table('malloytest.flights') extend {
88
94
  view: carrier is { group_by: carrier }
89
95
  }
90
- `).translationToFailWith("Cannot redefine 'carrier'");
96
+ `).toLog((0, test_translator_1.errorMessage)("Cannot redefine 'carrier'"));
91
97
  });
92
98
  test('redefine source', () => {
93
99
  expect((0, test_translator_1.markSource) `
@@ -97,27 +103,27 @@ describe('error handling', () => {
97
103
  source: airports is _db_.table('malloytest.airports') extend {
98
104
  primary_key: code
99
105
  }
100
- `).translationToFailWith("Cannot redefine 'airports'");
106
+ `).toLog((0, test_translator_1.errorMessage)("Cannot redefine 'airports'"));
101
107
  });
102
108
  test('query from undefined source', () => {
103
- expect((0, test_translator_1.markSource) `run: ${'x'}->{ select: y }`).translationToFailWith("Reference to undefined object 'x'");
109
+ expect((0, test_translator_1.markSource) `run: ${'x'}->{ select: y }`).toLog((0, test_translator_1.errorMessage)("Reference to undefined object 'x'"));
104
110
  });
105
111
  test('query with expression from undefined source', () => {
106
112
  // Regression check: Once upon a time this died with an exception even
107
113
  // when "query: x->{ group_by: y}" (above) generated the correct error.
108
- expect((0, test_translator_1.markSource) `run: ${'x'}->{ select: y is z / 2 }`).translationToFailWith("Reference to undefined object 'x'");
114
+ expect((0, test_translator_1.markSource) `run: ${'x'}->{ select: y is z / 2 }`).toLog((0, test_translator_1.errorMessage)("Reference to undefined object 'x'"));
109
115
  });
110
116
  test('join reference before definition', () => {
111
117
  expect((0, test_translator_1.markSource) `
112
118
  source: newAB is a extend { join_one: newB is ${'bb'} on astring }
113
119
  source: newB is b
114
- `).translationToFailWith("Reference to undefined object 'bb'");
120
+ `).toLog((0, test_translator_1.errorMessage)("Reference to undefined object 'bb'"));
115
121
  });
116
122
  test('non-rename rename', () => {
117
- expect('source: na is a extend { rename: astr is astr }').translationToFailWith("Can't rename field to itself");
123
+ expect('source: na is a extend { rename: astr is astr }').toLog((0, test_translator_1.errorMessage)("Can't rename field to itself"));
118
124
  });
119
125
  test('reference to field in its definition', () => {
120
- expect('source: na is a extend { dimension: ustr is upper(ustr) } ').translationToFailWith("Circular reference to 'ustr' in definition");
126
+ expect('source: na is a extend { dimension: ustr is upper(ustr) } ').toLog((0, test_translator_1.errorMessage)("Circular reference to 'ustr' in definition"));
121
127
  });
122
128
  test('empty model', () => {
123
129
  expect('').toTranslate();
@@ -126,38 +132,38 @@ describe('error handling', () => {
126
132
  expect('\n').toTranslate();
127
133
  });
128
134
  test('query without fields', () => {
129
- expect('run: a -> { top: 5 }').translationToFailWith("Can't determine view type (`group_by` / `aggregate` / `nest`, `project`, `index`)");
135
+ expect('run: a -> { top: 5 }').toLog((0, test_translator_1.error)('ambiguous-view-type'));
130
136
  });
131
137
  test('refine cannot change query type', () => {
132
- expect('run: ab -> aturtle + { select: astr }').translationToFailWith(/Not legal in grouping query/);
138
+ expect('run: ab -> aturtle + { select: astr }').toLog((0, test_translator_1.errorMessage)(/Not legal in grouping query/));
133
139
  });
134
140
  test('undefined field ref in query', () => {
135
- expect('run: ab -> { aggregate: xyzzy }').translationToFailWith("'xyzzy' is not defined");
141
+ expect('run: ab -> { aggregate: xyzzy }').toLog((0, test_translator_1.errorMessage)("'xyzzy' is not defined"));
136
142
  });
137
143
  test('query on source with errors', () => {
138
144
  expect((0, test_translator_1.markSource) `
139
145
  source: na is a extend { join_one: ${'n'} on astr }
140
- `).translationToFailWith("Reference to undefined object 'n'");
146
+ `).toLog((0, test_translator_1.errorMessage)("Reference to undefined object 'n'"));
141
147
  });
142
148
  test('detect duplicate output field names', () => {
143
- expect((0, test_translator_1.markSource) `run: ab -> { group_by: astr, ${'astr'} }`).translationToFailWith("Output already has a field named 'astr'");
149
+ expect((0, test_translator_1.markSource) `run: ab -> { group_by: astr, ${'astr'} }`).toLog((0, test_translator_1.errorMessage)("Output already has a field named 'astr'"));
144
150
  });
145
151
  test('detect join tail overlap existing ref', () => {
146
- expect((0, test_translator_1.markSource) `run: ab -> { group_by: astr, ${'b.astr'} }`).translationToFailWith("Output already has a field named 'astr'");
152
+ expect((0, test_translator_1.markSource) `run: ab -> { group_by: astr, ${'b.astr'} }`).toLog((0, test_translator_1.errorMessage)("Output already has a field named 'astr'"));
147
153
  });
148
154
  test('undefined in expression with regex compare', () => {
149
155
  expect(`
150
156
  source: c is a extend {
151
157
  dimension: d is meaning_of_life ~ r'(forty two|fifty four)'
152
158
  }
153
- `).translationToFailWith("'meaning_of_life' is not defined");
159
+ `).toLog((0, test_translator_1.errorMessage)("'meaning_of_life' is not defined"));
154
160
  });
155
161
  test('detect output collision on join references', () => {
156
162
  expect(`
157
163
  run: ab -> {
158
164
  group_by: astr, b.astr
159
165
  }
160
- `).translationToFailWith("Output already has a field named 'astr'");
166
+ `).toLog((0, test_translator_1.errorMessage)("Output already has a field named 'astr'"));
161
167
  });
162
168
  test('rejoin a query is renamed', () => {
163
169
  expect(`
@@ -175,7 +181,7 @@ describe('error handling', () => {
175
181
  `).toTranslate();
176
182
  });
177
183
  test('popping out of embedding when not embedded', () => {
178
- expect('}%').translationToFailWith(/extraneous input '}%' expecting/);
184
+ expect('}%').toLog((0, test_translator_1.errorMessage)(/extraneous input '}%' expecting/));
179
185
  });
180
186
  test('bad sql in sql block', () => {
181
187
  const badSelect = (0, test_translator_1.model) `source: someName is _db_.sql(")")`;
@@ -192,7 +198,7 @@ describe('error handling', () => {
192
198
  },
193
199
  });
194
200
  }
195
- expect(badTrans).translationToFailWith('Invalid SQL, Nobody ZZZZ');
201
+ expect(badTrans).toLog((0, test_translator_1.errorMessage)('Invalid SQL, Nobody ZZZZ'));
196
202
  });
197
203
  });
198
204
  describe('translate imports', () => {
@@ -222,7 +228,7 @@ describe('translation need error locations', () => {
222
228
  m.update({
223
229
  errors: { urls: { [(result.urls || [])[0]]: 'Bad file!' } },
224
230
  });
225
- expect(source).translationToFailWith(/Bad file!/);
231
+ expect(source).toLog((0, test_translator_1.errorMessage)(/Bad file!/));
226
232
  });
227
233
  test('sql struct error location', () => {
228
234
  const source = (0, test_translator_1.markSource) `
@@ -251,7 +257,7 @@ describe('translation need error locations', () => {
251
257
  tables: { [Object.keys(result.tables || {})[0]]: 'Bad table!' },
252
258
  },
253
259
  });
254
- expect(m).translationToFailWith(/Bad table!/);
260
+ expect(m).toLog((0, test_translator_1.errorMessage)(/Bad table!/));
255
261
  });
256
262
  });
257
263
  describe('error cascading', () => {
@@ -259,7 +265,7 @@ describe('error cascading', () => {
259
265
  expect((0, test_translator_1.markSource) `
260
266
  source: a1 is a extend { dimension: ${'x is count()'} }
261
267
  source: a2 is a extend { dimension: ${'x is count()'} }
262
- `).translationToFailWith('Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?', 'Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?');
268
+ `).toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?'), (0, test_translator_1.errorMessage)('Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?'));
263
269
  });
264
270
  const typedScalars = {
265
271
  'err': 'error',
@@ -335,7 +341,7 @@ describe('error cascading', () => {
335
341
  .map((m, i) => `e${i + scalars.length} is ${m}`)
336
342
  .join('\n ')}
337
343
  }
338
- `).translationToFailWith("'nothing' is not defined", "'foo' is not defined");
344
+ `).toLog((0, test_translator_1.errorMessage)("'nothing' is not defined"), (0, test_translator_1.errorMessage)("'foo' is not defined"));
339
345
  });
340
346
  test('error type inference is good', () => {
341
347
  for (const scalar of scalars) {
@@ -346,7 +352,7 @@ describe('error cascading', () => {
346
352
  dim is length(${scalar}, 1)
347
353
  }
348
354
  `;
349
- expect(source).translationToFailWith("'nothing' is not defined", `No matching overload for function length(${typedScalars[scalar]}, number)`);
355
+ expect(source).toLog((0, test_translator_1.errorMessage)("'nothing' is not defined"), (0, test_translator_1.errorMessage)(`No matching overload for function length(${typedScalars[scalar]}, number)`));
350
356
  }
351
357
  });
352
358
  test('eval space of errors is preserved', () => {
@@ -367,7 +373,7 @@ describe('error cascading', () => {
367
373
  .map((m, i) => `e${i + scalars.length} is lag(${m})`)
368
374
  .join('\n ')}
369
375
  }
370
- `).translationToFailWith("'nothing' is not defined", "'foo' is not defined");
376
+ `).toLog((0, test_translator_1.errorMessage)("'nothing' is not defined"), (0, test_translator_1.errorMessage)("'foo' is not defined"));
371
377
  });
372
378
  });
373
379
  describe('pipeline comprehension', () => {
@@ -391,7 +397,7 @@ describe('pipeline comprehension', () => {
391
397
  select: ${'ai'}
392
398
  }
393
399
  }
394
- `).translationToFailWith("'ai' is not defined");
400
+ `).toLog((0, test_translator_1.errorMessage)("'ai' is not defined"));
395
401
  });
396
402
  test('new query can append ops to existing query', () => {
397
403
  expect(`
@@ -551,7 +557,7 @@ describe('sql expressions', () => {
551
557
  m.update({
552
558
  compileSQL: { [compileSql.name]: (0, test_translator_1.getSelectOneStruct)(compileSql) },
553
559
  });
554
- expect(m).translationToFailWith('Cannot add view refinements to a source');
560
+ expect(m).toLog((0, test_translator_1.errorMessage)('Cannot add view refinements to a source'));
555
561
  }
556
562
  });
557
563
  test('reference to sql expression in join', () => {
@@ -625,7 +631,7 @@ describe('sql expressions', () => {
625
631
  m.update({
626
632
  compileSQL: { [compileSql.name]: (0, test_translator_1.getSelectOneStruct)(compileSql) },
627
633
  });
628
- expect(m).translationToFailWith('A raw query cannot be refined');
634
+ expect(m).toLog((0, test_translator_1.errorMessage)('A raw query cannot be refined'));
629
635
  }
630
636
  });
631
637
  test('cannot refine a SQL query directly', () => {
@@ -639,7 +645,7 @@ describe('sql expressions', () => {
639
645
  m.update({
640
646
  compileSQL: { [compileSql.name]: (0, test_translator_1.getSelectOneStruct)(compileSql) },
641
647
  });
642
- expect(m).translationToFailWith('Cannot add view refinements to a source');
648
+ expect(m).toLog((0, test_translator_1.errorMessage)('Cannot add view refinements to a source'));
643
649
  }
644
650
  });
645
651
  });
@@ -658,7 +664,7 @@ describe('extend and refine', () => {
658
664
  `).toTranslate();
659
665
  });
660
666
  test('source name with query refinements', () => {
661
- expect('run: a + { group_by: ai }').translationToFailWith("Cannot add view refinements to 'a' because it is a source");
667
+ expect('run: a + { group_by: ai }').toLog((0, test_translator_1.errorMessage)("Cannot add view refinements to 'a' because it is a source"));
662
668
  });
663
669
  test('source name with source refinements', () => {
664
670
  expect('source: s is a extend { dimension: ai_2 is ai + ai }').toTranslate();
@@ -684,7 +690,7 @@ describe('extend and refine', () => {
684
690
  `).toTranslate();
685
691
  });
686
692
  test('source name with query refinements', () => {
687
- expect('run: a + { group_by: one }').translationToFailWith("Cannot add view refinements to 'a' because it is a source");
693
+ expect('run: a + { group_by: one }').toLog((0, test_translator_1.errorMessage)("Cannot add view refinements to 'a' because it is a source"));
688
694
  });
689
695
  test('source name with source refinements', () => {
690
696
  expect('source: s is a extend { dimension: ai_2 is ai + ai }').toTranslate();
@@ -695,7 +701,7 @@ describe('extend and refine', () => {
695
701
  ##! -m4warnings
696
702
  query: q is a -> { group_by: ai }
697
703
  run: q + { join_one: b on 1 = 1 } -> { select: b.* }
698
- `).translationToFailWith("No such field as 'b'");
704
+ `).toLog((0, test_translator_1.errorMessage)("No such field as 'b'"));
699
705
  expect(`
700
706
  ##! -m4warnings
701
707
  query: q is a -> { group_by: ai }
@@ -764,10 +770,10 @@ describe('extend and refine', () => {
764
770
  });
765
771
  describe('extend and refine fallout', () => {
766
772
  test('syntactically valid to run a source, but still illegal', () => {
767
- expect('run: a').translationToFailWith("Illegal reference to 'a', query expected");
773
+ expect('run: a').toLog((0, test_translator_1.errorMessage)("Illegal reference to 'a', query expected"));
768
774
  });
769
775
  test('syntactically valid to refine a source, but illegal', () => {
770
- expect('run: a + { group_by: ai } ').translationToFailWith("Cannot add view refinements to 'a' because it is a source");
776
+ expect('run: a + { group_by: ai } ').toLog((0, test_translator_1.errorMessage)("Cannot add view refinements to 'a' because it is a source"));
771
777
  });
772
778
  });
773
779
  describe('turtles', () => {
@@ -810,7 +816,7 @@ describe('miscellaneous m4 warnings', () => {
810
816
  expect(`
811
817
  ##! m4warnings=warn
812
818
  query: q is a -> { project: * }
813
- `).toTranslateWithWarnings('project: keyword is deprecated, use select:');
819
+ `).toLog((0, test_translator_1.warningMessage)('project: keyword is deprecated, use select:'));
814
820
  });
815
821
  test('query leading arrow', () => {
816
822
  expect(`
@@ -832,8 +838,8 @@ describe('m3/m4 source query sentences', () => {
832
838
  // todo MTOY write test to make sure arrow has correct precedence vs +
833
839
  // also maybe arrow vs extend
834
840
  test('M4 should error on these sq expressions', () => {
835
- expect(`source: s is a + ${qryRefine}`).translationToFailWith("Cannot add view refinements to 'a' because it is a source");
836
- expect(`query: q_m4_err is a + ${qryRefine}`).translationToFailWith("Cannot add view refinements to 'a' because it is a source");
841
+ expect(`source: s is a + ${qryRefine}`).toLog((0, test_translator_1.errorMessage)("Cannot add view refinements to 'a' because it is a source"));
842
+ expect(`query: q_m4_err is a + ${qryRefine}`).toLog((0, test_translator_1.errorMessage)("Cannot add view refinements to 'a' because it is a source"));
837
843
  });
838
844
  test('legal sqexpressions', () => {
839
845
  // some things that are m4 warnings are commented out
@@ -879,10 +885,4 @@ describe('sql_functions', () => {
879
885
  });
880
886
  });
881
887
  test('non breaking space in source', () => expect('source:\u00a0z\u00a0is\u00a0a').toParse());
882
- test('error tagging', () => {
883
- const m = (0, test_translator_1.model) `run: a -> { select: err is pick 1 when true else 'one' }`;
884
- expect(m).translationToFailWith("else type 'string', expected 'number'");
885
- const firstErr = m.translator.root.logger.getLog()[0];
886
- expect(firstErr === null || firstErr === void 0 ? void 0 : firstErr.errorTag).toBe('pick-values-must-match');
887
- });
888
888
  //# sourceMappingURL=parse.spec.js.map