@@ -28,9 +28,10 @@ tailor-sdk function [command]
2828
2929** Commands**
3030
31- | Command | Description |
32- | --------------------------------- | ------------------------------------ |
33- | [ ` function logs ` ] ( #function-logs ) | List or get function execution logs. |
31+ | Command | Description |
32+ | ----------------------------------------- | --------------------------------------------------------------- |
33+ | [ ` function logs ` ] ( #function-logs ) | List or get function execution logs. |
34+ | [ ` function test-run ` ] ( #function-test-run ) | Run a function on the Tailor Platform server without deploying. |
3435
3536<!-- politty:command:function:subcommands:end -->
3637<!-- politty:command:function logs:heading:start -->
@@ -90,3 +91,82 @@ tailor-sdk function logs <execution-id>
9091tailor-sdk function logs --json
9192tailor-sdk function logs < execution-id> --json
9293```
94+
95+ <!-- politty:command:function test-run:heading:start -->
96+
97+ ## function test-run
98+
99+ <!-- politty:command:function test-run:heading:end -->
100+ <!-- politty:command:function test-run:description:start -->
101+
102+ Run a function on the Tailor Platform server without deploying.
103+
104+ <!-- politty:command:function test-run:description:end -->
105+ <!-- politty:command:function test-run:usage:start -->
106+
107+ ** Usage**
108+
109+ ```
110+ tailor-sdk function test-run [options] <file>
111+ ```
112+
113+ <!-- politty:command:function test-run:usage:end -->
114+ <!-- politty:command:function test-run:arguments:start -->
115+
116+ ** Arguments**
117+
118+ | Argument | Description | Required |
119+ | -------- | ------------------------- | -------- |
120+ | ` file ` | Path to the function file | Yes |
121+
122+ <!-- politty:command:function test-run:arguments:end -->
123+ <!-- politty:command:function test-run:options:start -->
124+
125+ ** Options**
126+
127+ | Option | Alias | Description | Required | Default |
128+ | ------------------------------- | ----- | ------------------------------------------------------------------------ | -------- | -------------------- |
129+ | ` --json ` | ` -j ` | Output as JSON | No | ` false ` |
130+ | ` --workspace-id <WORKSPACE_ID> ` | ` -w ` | Workspace ID | No | - |
131+ | ` --profile <PROFILE> ` | ` -p ` | Workspace profile | No | - |
132+ | ` --name <NAME> ` | ` -n ` | Workflow job name to run (matches the ` name ` field of createWorkflowJob) | No | - |
133+ | ` --arg <ARG> ` | ` -a ` | JSON argument to pass to the function | No | - |
134+ | ` --machine-user <MACHINE_USER> ` | ` -m ` | Machine user name for authentication | No | - |
135+ | ` --config <CONFIG> ` | ` -c ` | Path to SDK config file | No | ` "tailor.config.ts" ` |
136+
137+ <!-- politty:command:function test-run:options:end -->
138+ <!-- politty:command:function test-run:examples:start -->
139+
140+ ** Examples**
141+
142+ ** Run a resolver with input arguments**
143+
144+ ``` bash
145+ $ tailor-sdk function test-run resolvers/add.ts --arg ' {"input":{"a":1,"b":2}}'
146+ ```
147+
148+ ** Run a specific workflow job by name**
149+
150+ ``` bash
151+ $ tailor-sdk function test-run workflows/sample.ts --name validate-order
152+ ```
153+
154+ ** Run a pre-bundled .js file directly**
155+
156+ ``` bash
157+ $ tailor-sdk function test-run .tailor-sdk/resolvers/add.js --arg ' {"input":{"a":1,"b":2}}'
158+ ```
159+
160+ <!-- politty:command:function test-run:examples:end -->
161+ <!-- politty:command:function test-run:notes:start -->
162+
163+ ** Notes**
164+
165+ You can pass either a source file (` .ts ` ) or a pre-bundled file (` .js ` ).
166+ When a ` .js ` file is provided, detection and bundling are skipped and the file is executed as-is.
167+
168+ > [ !WARNING]
169+ > Workflow job ` .trigger() ` calls do not work in test-run mode.
170+ > Triggered jobs are not executed; only the target job's ` body ` function runs in isolation.
171+
172+ <!-- politty:command:function test-run:notes:end -->
0 commit comments