Repository navigation
Open
Description
Problem
When compiling code with test for an incremental table, dataform returns an incorrect error message.
Expected behavior
The compile error should be: Running tests on incremental datasets is not yet supported.
Actual behavior
The compile error is: Dataset xxx could not be found.
Minimal Reproduction
definitions/sample.sqlx
config { type: "incremental", name: "sample" }
SELECT * FROM ${ref("sample-ref")}
definitions/test.js
test("sample-test")
.database("sample")
.input("sample-ref", "SELECT 1 AS foo")
.expect("SELECT 1 AS foo")definitions/sample-ref.sqlx
config { type: "declaration", schema: "bar", name: "sample-ref" }
Suggested Fix
It seems that changing the following conditions might be enough to fix this.
Lines 171 to 182 in 586f1d5
| const dataset = allResolved.length > 0 ? allResolved[0] : undefined; | |
| if (!(dataset && (dataset instanceof Table || dataset instanceof View))) { | |
| this.session.compileError( | |
| new Error(`Dataset ${stringifyResolvable(this.datasetToTest)} could not be found.`), | |
| this.proto.fileName | |
| ); | |
| } else if (dataset instanceof IncrementalTable) { | |
| this.session.compileError( | |
| new Error("Running tests on incremental datasets is not yet supported."), | |
| this.proto.fileName | |
| ); | |
| } else { |
likes
const dataset = allResolved.length > 0 ? allResolved[0] : undefined;
- if (!(dataset && (dataset instanceof Table || dataset instanceof View))) {
+ if (!(dataset && (dataset instanceof Table || dataset instanceof View || dataset instanceof IncrementalTable))) {
this.session.compileError(
new Error(`Dataset ${stringifyResolvable(this.datasetToTest)} could not be found.`),
this.proto.fileName
);
} else if (dataset instanceof IncrementalTable) {
this.session.compileError(
new Error("Running tests on incremental datasets is not yet supported."),
this.proto.fileName
);
} else {
Metadata
Metadata
Assignees
Labels
No labels
Activity