New feature: Implicit pending steps
Normally you want to mark your test as pending, you would have to import the pending function and use it:
const { action, pending } = require('prescript')
action`Open browser`(async (state) => {
state.browser = ...
})
defer`Close browser`(async (state) => {
state.browser.close()
})
pending() // <- Mark the test as pending.
// In development mode, the test will pause here, before "Close Browser".
// In non-development mode, the test will exit with status code 2.
Now, you can omit the function parts of to
and action
implicitly mark the test as pending.
const { action, pending } = require('prescript')
action`Open browser`(async (state) => {
state.browser = ...
})
defer`Close browser`(async (state) => {
state.browser.close()
})
action`Do one thing`() // <- Since there is no action function passed, the test is considered pending
// You can use this feature to plan your test.
// Just write the actions you want to take first,
// then fill in with actual implementation later.
action`Do another thing`()
Note that implicit pending does not support the action('String')
syntax.
New feature: independent
steps
Normally when one step fails, it causes the whole test to fail. But sometimes, you want to test multiple things which are independent of each other. However, putting them in separate test scripts can be wasteful. Now you can use independent
block.
independent(() => {
action`Verify name`(...)
action`Verify location`(...)
action`Verify balance`(...)
})
Without an independent
block, if the "Verify location" step fails, the test will be aborted and the "Verify balance" step will not run.
With the independent
block, all three actions will be run, regardless of the results of the previous steps inside the independent block.
Allure JS integration upgraded to version 2
prescript has a built-in integration with the Allure test reporting framework. The previous version uses XML which suffers when the error message contains ANSI escape codes. The new version now uses JSON.
Misc
- Upgraded CI to Node 14