-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
170 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
# 20.0.1 | ||
|
||
- hoist current definition environment output to engine environment output if run fails | ||
- Major bump `bpmn-moddle@9` | ||
- Minor bump [`[email protected]`](https://github.com/paed01/moddle-context-serializer/blob/master/CHANGELOG.md) | ||
- Minor bump [`[email protected]`](https://github.com/paed01/bpmn-elements/blob/master/CHANGELOG.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<!-- version --> | ||
|
||
# 20.0.0 API Reference | ||
# 20.0.1 API Reference | ||
|
||
<!-- versionstop --> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { Engine } from '../../src/index.js'; | ||
|
||
Feature('Engine output', () => { | ||
Scenario('Process completes with output', () => { | ||
let engine; | ||
Given('a process with output', () => { | ||
const source = `<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions id="script-definition" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="http://bpmn.io/schema/bpmn"> | ||
<process id="my-process" isExecutable="true"> | ||
<scriptTask id="task" scriptFormat="javascript"> | ||
<script><![CDATA[ | ||
environment.output.foo = 'bar'; | ||
next(); | ||
]]> | ||
</script> | ||
</scriptTask> | ||
</process> | ||
</definitions>`; | ||
|
||
engine = new Engine({ source }); | ||
}); | ||
|
||
let end; | ||
When('ran', () => { | ||
end = engine.waitFor('end'); | ||
engine.execute(); | ||
}); | ||
|
||
Then('run completes', () => { | ||
return end; | ||
}); | ||
|
||
And('engine state contain hoisted process output', async () => { | ||
expect((await engine.getState()).environment.output).to.deep.equal({ foo: 'bar' }); | ||
}); | ||
|
||
Given('a process with call activity and a called process', () => { | ||
const source = `<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions id="script-definition" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="http://bpmn.io/schema/bpmn"> | ||
<process id="my-process" isExecutable="true"> | ||
<callActivity id="call-activity" calledElement="called-process" /> | ||
<sequenceFlow id="to-task" sourceRef="call-activity" targetRef="task" /> | ||
<scriptTask id="task" scriptFormat="javascript"> | ||
<script><![CDATA[ | ||
environment.output.foo = 'bar'; | ||
next(); | ||
]]> | ||
</script> | ||
</scriptTask> | ||
</process> | ||
<process id="called-process" isExecutable="false"> | ||
<scriptTask id="called-task" scriptFormat="javascript"> | ||
<script><![CDATA[ | ||
environment.output.bar = 'baz'; | ||
next(); | ||
]]> | ||
</script> | ||
</scriptTask> | ||
</process> | ||
</definitions>`; | ||
|
||
engine = new Engine({ source }); | ||
}); | ||
|
||
When('ran', () => { | ||
end = engine.waitFor('end'); | ||
engine.execute(); | ||
}); | ||
|
||
Then('run completes', () => { | ||
return end; | ||
}); | ||
|
||
And('engine state contain hoisted main process output', async () => { | ||
expect((await engine.getState()).environment.output).to.deep.equal({ foo: 'bar' }); | ||
}); | ||
}); | ||
|
||
Scenario('process fails', () => { | ||
let engine; | ||
Given('a process with output', () => { | ||
const source = `<?xml version="1.0" encoding="UTF-8"?> | ||
<definitions id="script-definition" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="http://bpmn.io/schema/bpmn"> | ||
<process id="my-process" isExecutable="true"> | ||
<scriptTask id="task" scriptFormat="javascript"> | ||
<script><![CDATA[ | ||
environment.output.foo = 'bar'; | ||
baz(); | ||
next(); | ||
]]> | ||
</script> | ||
</scriptTask> | ||
</process> | ||
</definitions>`; | ||
|
||
engine = new Engine({ source }); | ||
}); | ||
|
||
let errored; | ||
When('ran', () => { | ||
errored = engine.waitFor('error'); | ||
engine.execute(); | ||
}); | ||
|
||
Then('run fails', () => { | ||
return errored; | ||
}); | ||
|
||
And('engine state contain hoisted process output', async () => { | ||
expect((await engine.getState()).environment.output).to.deep.equal({ foo: 'bar' }); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"include": ["src/**/*", "types"], | ||
"compilerOptions": { | ||
"emitDeclarationOnly": true, | ||
"sourceMap": false, | ||
"rootDir": "src", | ||
"lib": ["es2017"], | ||
"target": "es2017", | ||
"outDir": "./tmp/ignore", | ||
"declaration": true, | ||
"noEmitOnError": true, | ||
"noErrorTruncation": true, | ||
"allowJs": true, | ||
"checkJs": false, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"stripInternal": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"typeRoots": ["./node_modules/@types"], | ||
"paths": { | ||
"types": ["./types/bpmn-engine.js"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters