jason810496 opened a new issue, #77618:
URL: https://github.com/apache/airflow/issues/77618

   ### Body
   
   Dag authors using the TypeScript SDK have no supported way to test their 
Dags locally.
   It came up in the feedback on #76370, most concretely in [this 
comment](https://github.com/apache/airflow/issues/76370#issuecomment-7158251383).
   
   What authors run into today:
   
   - `bundle.getTaskHandler` returns the SDK's wrapper, so even a `dag.if` 
decider that compares two dates throws `getClient() is only available inside a 
task handler`.
   - To test a handler that calls `getContext()` or `getClient()`, you have to 
put a fake scope into the SDK's private storage. Any release can break that.
   - `airflow dags test` says it cannot find a TypeScript Dag, while the same 
Dag runs fine when scheduled.
   
   ## Scope
   
   ### 1. Test a single task
   
   Run one task, or one task handler, with given inputs, Variables, Connections 
and context. Check its result, its XComs and which downstream tasks it skips.
   
   ### 2. Test the whole Dag
   
   Run the tasks of a Dag in the order its dependencies define, applying 
trigger rules and branches (`dag.if`, `dag.switch`). Check the final state and 
the XComs of each task.
   
   ## Open question: where it lives
   
   We have not picked the approach yet. The options so far:
   
   - A testing package in the SDK, such as `@apache-airflow/ts-sdk/testing`, 
that works with any test runner.
   - A TypeScript SDK CLI command, next to `airflow-ts-pack`.
   - The compiled bundle itself, run directly with something like `node 
dist/bundle.min.mjs ...`, so what you test is the artifact you deploy.
   - The Airflow CLI, for example `airflow dags test` working with TypeScript 
Dags.
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to