Skip to content

Commit 9d284bb

Browse files
Merge pull request #107 from nursoltan-s/clean-data-first-newman
clean data before run test
2 parents 8622060 + fcb1fba commit 9d284bb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/postman/newman.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,17 @@ async function clearTestData () {
183183
/**
184184
* Run the postman tests.
185185
*/
186-
apiTestLib.runTests(requests, require.resolve('./resource-api.postman_collection.json'),
187-
require.resolve('./resource-api.postman_environment.json')).then(async () => {
188-
logger.info('newman test completed!')
189-
await clearTestData()
190-
}).catch(async (err) => {
191-
logger.logFullError(err)
192-
193-
// Only calling the clean up function when it is not validation error.
194-
if (err.name !== 'ValidationError') {
186+
clearTestData().then(() => {
187+
apiTestLib.runTests(requests, require.resolve('./resource-api.postman_collection.json'),
188+
require.resolve('./resource-api.postman_environment.json')).then(async () => {
189+
logger.info('newman test completed!')
195190
await clearTestData()
196-
}
191+
}).catch(async (err) => {
192+
logger.logFullError(err)
193+
194+
// Only calling the clean up function when it is not validation error.
195+
if (err.name !== 'ValidationError') {
196+
await clearTestData()
197+
}
198+
})
197199
})

0 commit comments

Comments
 (0)