Merge pull request #15472 from Budibase/budi-9023-when-a-formula-column-errors-it-affects-other-formula
clear results context on every run
This commit is contained in:
commit
07047b2c7e
|
@ -107,4 +107,15 @@ describe("Test isolated vm directly", () => {
|
|||
)
|
||||
expect(result).toEqual([])
|
||||
})
|
||||
|
||||
it("should ensure error results are cleared between runs", () => {
|
||||
const context = {}
|
||||
// throw error
|
||||
// Ensure the first execution throws an error
|
||||
expect(() => runJSWithIsolatedVM(`test.foo.bar = 123`, context)).toThrow()
|
||||
|
||||
// Ensure the error is not persisted across VMs
|
||||
const secondResult = runJSWithIsolatedVM(`return {}`, context)
|
||||
expect(secondResult).toEqual({})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -186,6 +186,7 @@ export class IsolatedVM implements VM {
|
|||
|
||||
code = `
|
||||
try {
|
||||
results = {}
|
||||
results['${this.runResultKey}']=${this.codeWrapper(code)}
|
||||
} catch (e) {
|
||||
results['${this.runErrorKey}']=e
|
||||
|
|
Loading…
Reference in New Issue