Skip to content

Commit

Permalink
Merge pull request #662 from OpenFn/fix-cli-only
Browse files Browse the repository at this point in the history
Fix cli only
  • Loading branch information
josephjclark authored Apr 15, 2024
2 parents d325c42 + 6b58867 commit 65e4031
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
28 changes: 21 additions & 7 deletions integration-tests/cli/test/execute-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ test.serial(`openfn ${jobsPath}/wf-array.json`, async (t) => {
t.falsy(err);

const out = getJSON();
t.is(out.data.items.length, 2);
t.is(out.data.items.length, 3);
t.true(out.data.items.includes('c'));
t.true(out.data.items.includes('b'));
t.true(out.data.items.includes('c'));
});
Expand All @@ -62,14 +63,12 @@ test.serial(
t.falsy(err);

const out = getJSON();
t.is(out.data.items.length, 3);
t.true(out.data.items.includes('z'));
t.true(out.data.items.includes('b'));
t.true(out.data.items.includes('c'));
t.is(out.data.items.length, 4);
t.deepEqual(out.data.items, ['z', 'a', 'b', 'c']);
}
);

// special start node
// special start step
test.serial(
`openfn ${jobsPath}/wf-array.json --start b -S "{ \\"data\\": { \\"items\\": [] } }"`,
async (t) => {
Expand All @@ -83,6 +82,21 @@ test.serial(
}
);

// only step
test.serial(
`openfn ${jobsPath}/wf-array.json --only b -S "{ \\"data\\": { \\"items\\": [] } }"`,
async (t) => {
const { err } = await run(t.title);
t.falsy(err);

const out = getJSON();
t.is(out.data.items.length, 1);
t.false(out.data.items.includes('a'));
t.true(out.data.items.includes('b'));
t.false(out.data.items.includes('c'));
}
);

// Run a new-style execution plan with custom start
test.serial(`openfn ${jobsPath}/plan.json -i`, async (t) => {
const { err } = await run(t.title);
Expand Down Expand Up @@ -185,6 +199,6 @@ test.serial(
t.falsy(err);

const out = getJSON();
t.deepEqual(out, { data: '01/01/2024', result: '1/1/2024, 12:00:00 AM' })
t.deepEqual(out, { data: '01/01/2024', result: '1/1/2024, 12:00:00 AM' });
}
);
2 changes: 1 addition & 1 deletion integration-tests/cli/test/fixtures/wf-array.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"id": "a",
"adaptor": "common",
"expression": "fn((state) => { if (!state.data.items) { state.data.items = []; } return state; });",
"expression": "fn((state) => { if (!state.data.items) { state.data.items = []; } state.data.items.push('a'); return state; });",
"next": { "b": true }
},
{
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/cli

## 1.2.1

### Patch Changes

- Fix --end and --only

## 1.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.2.0",
"version": "1.2.1",
"description": "CLI devtools for the openfn toolchain.",
"engines": {
"node": ">=18",
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/execute/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ const options = [
o.autoinstall,
o.cacheSteps,
o.compile,
o.immutable,
o.end,
o.ignoreImports,
o.immutable,
o.inputPath,
o.log,
o.logJson,
o.only,
o.outputPath,
o.outputStdout,
o.repoDir,
o.skipAdaptorValidation,
o.sanitize,
o.skipAdaptorValidation,
o.start,
o.statePath,
o.stateStdin,
Expand Down

0 comments on commit 65e4031

Please sign in to comment.