@nrfcloud/bdd-feature-runner-aws
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -20,3 +20,3 @@ "use strict"; | ||
this.subscriberMessages[id].push(result); | ||
onMatch.forEach(fn => fn(result)); | ||
onMatch.forEach((fn) => fn(result)); | ||
} | ||
@@ -40,3 +40,3 @@ }); | ||
// Notify about existing messages | ||
this.messages.forEach(message => this.notifySubcribers(message)); | ||
this.messages.forEach((message) => this.notifySubcribers(message)); | ||
}; | ||
@@ -84,3 +84,3 @@ this.disconnect = () => { | ||
onSuccess: async () => { | ||
await Promise.all(topics.map(topic => new Promise((resolve1, reject1) => { | ||
await Promise.all(topics.map((topic) => new Promise((resolve1, reject1) => { | ||
this.client.subscribe(topic, { | ||
@@ -87,0 +87,0 @@ onSuccess: resolve1, |
@@ -16,7 +16,7 @@ "use strict"; | ||
console.log(''); | ||
result.featureResults.forEach(featureResult => { | ||
result.featureResults.forEach((featureResult) => { | ||
reportFeature(featureResult); | ||
featureResult.scenarioResults.forEach(scenarioResult => { | ||
featureResult.scenarioResults.forEach((scenarioResult) => { | ||
reportScenario(scenarioResult); | ||
scenarioResult.stepResults.forEach(stepResult => { | ||
scenarioResult.stepResults.forEach((stepResult) => { | ||
reportStep(stepResult, this.config); | ||
@@ -38,3 +38,3 @@ }); | ||
let featureFailed = false; | ||
result.featureResults.forEach(featureResult => { | ||
result.featureResults.forEach((featureResult) => { | ||
featureFailed = false; | ||
@@ -49,3 +49,3 @@ if (featureResult.feature.skip) { | ||
} | ||
featureResult.scenarioResults.forEach(scenarioResult => { | ||
featureResult.scenarioResults.forEach((scenarioResult) => { | ||
scenarios++; | ||
@@ -189,3 +189,3 @@ if (featureResult.feature.skip || scenarioResult.skipped) { | ||
...(Array.isArray(result.result) ? result.result : [result.result]), | ||
].forEach(r => { | ||
].forEach((r) => { | ||
console.log(chalk.cyan(' ▶'), chalk.cyan(JSON.stringify(r))); | ||
@@ -192,0 +192,0 @@ }); |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.parseFeatures = (featureData) => { | ||
const parsedFeatures = featureData.map(d => { | ||
const parsedFeatures = featureData.map((d) => { | ||
// Parse the feature files | ||
@@ -22,3 +22,3 @@ const scanner = new Gherkin.TokenScanner(d.toString()); | ||
// Sort the features by the step 'I am run after the "..." feature' using toposort | ||
const featureDependencies = parsedFeatures.map(feature => { | ||
const featureDependencies = parsedFeatures.map((feature) => { | ||
const bg = feature.children.find(({ type }) => type === 'Background'); | ||
@@ -47,7 +47,7 @@ if (bg) { | ||
.map(({ name }) => name); | ||
return sortedFeatures.map(f => { | ||
return sortedFeatures.map((f) => { | ||
const { tags, name: featureName } = f; | ||
const skip = tags.find(({ name }) => name === '@Skip') || | ||
(only.length && !only.includes(featureName)); | ||
return Object.assign({}, f, { skip: !!skip }); | ||
return Object.assign(Object.assign({}, f), { skip: !!skip }); | ||
}); | ||
@@ -58,3 +58,3 @@ }; | ||
const featureFiles = await glob(scan); | ||
return exports.parseFeatures(featureFiles.map(f => fs_1.readFileSync(f))); | ||
return exports.parseFeatures(featureFiles.map((f) => fs_1.readFileSync(f))); | ||
}; |
@@ -24,3 +24,4 @@ "use strict"; | ||
async request(method, path, queryString, extraHeaders, body, passBinary = false, directUrl = false, jsonResponseRequired = true) { | ||
const headers = Object.assign({}, this.headers, extraHeaders); | ||
var _a; | ||
const headers = Object.assign(Object.assign({}, this.headers), extraHeaders); | ||
let apiGatewayUrlPrefix = ''; | ||
@@ -36,6 +37,7 @@ if (!directUrl) { | ||
: undefined; | ||
headers['Content-Type'] = | ||
body != null && !passBinary && typeof body !== 'string' | ||
? 'application/json' | ||
: 'text/plain'; | ||
console.log(headers); | ||
const detectedContentType = body != null && !passBinary && typeof body !== 'string' | ||
? 'application/json' | ||
: 'text/plain'; | ||
headers['Content-Type'] = (_a = headers['Content-Type']) !== null && _a !== void 0 ? _a : detectedContentType; | ||
// Uncomment for debug | ||
@@ -57,2 +59,3 @@ /* console.log( | ||
const text = await res.text(); | ||
// console.log(res.headers, text); | ||
if (headers.Accept.indexOf(mediaType) < 0) { | ||
@@ -59,0 +62,0 @@ throw new Error(`The content-type "${contentType}" of the response does not match accepted media-type ${headers.Accept}`); |
@@ -25,3 +25,3 @@ "use strict"; | ||
async progress(type, info) { | ||
await Promise.all(this.reporters.map(reporter => reporter.progress(type, info))); | ||
await Promise.all(this.reporters.map((reporter) => reporter.progress(type, info))); | ||
} | ||
@@ -40,4 +40,4 @@ async run() { | ||
}; | ||
await Promise.all(this.reporters.map(reporter => reporter.report(result))); | ||
await this.cleaners.reduce((promise, cleaner) => promise.then(async () => cleaner(this).then(res => this.progress('cleaner', res))), Promise.resolve()); | ||
await Promise.all(this.reporters.map((reporter) => reporter.report(result))); | ||
await this.cleaners.reduce((promise, cleaner) => promise.then(async () => cleaner(this).then((res) => this.progress('cleaner', res))), Promise.resolve()); | ||
return result; | ||
@@ -79,4 +79,4 @@ } | ||
name: `${scenario.name} (${values.join(',')})`, | ||
steps: scenario.steps.map(step => (Object.assign({}, step, { text: replace(step.text), argument: step.argument | ||
? Object.assign({}, step.argument, { content: replace(step.argument.content) }) : undefined }))), | ||
steps: scenario.steps.map((step) => (Object.assign(Object.assign({}, step), { text: replace(step.text), argument: step.argument | ||
? Object.assign(Object.assign({}, step.argument), { content: replace(step.argument.content) }) : undefined }))), | ||
}; | ||
@@ -116,3 +116,3 @@ scenarioResults.push(await this.retryScenario(s)); | ||
const r = await this.runScenario(scenario); | ||
lastResult = Object.assign({}, r, { tries: num + 1 }); | ||
lastResult = Object.assign(Object.assign({}, r), { tries: num + 1 }); | ||
if (lastResult.success) { | ||
@@ -142,3 +142,3 @@ return resolve(lastResult); | ||
success: false, | ||
step: Object.assign({}, step, { interpolatedText: step.text }), | ||
step: Object.assign(Object.assign({}, step), { interpolatedText: step.text }), | ||
}); | ||
@@ -154,3 +154,3 @@ } | ||
success: false, | ||
step: Object.assign({}, step, { interpolatedText: step.text }), | ||
step: Object.assign(Object.assign({}, step), { interpolatedText: step.text }), | ||
error, | ||
@@ -173,3 +173,3 @@ skipped: false, | ||
await this.progress('step', step.text); | ||
const interpolatedStep = Object.assign({}, step, { interpolatedText: this.replaceStoragePlaceholders(step.text), interpolatedArgument: step.argument | ||
const interpolatedStep = Object.assign(Object.assign({}, step), { interpolatedText: this.replaceStoragePlaceholders(step.text), interpolatedArgument: step.argument | ||
? this.replaceStoragePlaceholders(step.argument.content) | ||
@@ -213,7 +213,7 @@ : undefined }); | ||
replaceStoragePlaceholders(text) { | ||
const data = Object.assign({}, this.world, this.store); | ||
const data = Object.assign(Object.assign({}, this.world), this.store); | ||
const interpolated = Object.keys(data).reduce((str, key) => str.replace(new RegExp(`{${key}}`, 'g'), data[key]), text); | ||
const missed = interpolated.match(/\{[^}\W]+\}/g); | ||
if (missed && missed.length) { | ||
throw new StoreKeyUndefinedError(missed.map(k => k.slice(1, -1)), data); | ||
throw new StoreKeyUndefinedError(missed.map((k) => k.slice(1, -1)), data); | ||
} | ||
@@ -220,0 +220,0 @@ return interpolated; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const Outputs = (Stacks && Stacks[0].Outputs) || []; | ||
return Outputs.reduce((outputs, { OutputKey, OutputValue }) => (Object.assign({}, outputs, { [OutputKey]: OutputValue })), {}); | ||
return Outputs.reduce((outputs, { OutputKey, OutputValue }) => (Object.assign(Object.assign({}, outputs), { [OutputKey]: OutputValue })), {}); | ||
}; |
@@ -18,3 +18,3 @@ "use strict"; | ||
exports.appSyncAfterAll = async (runner) => { | ||
Object.keys(runner.store.appSyncClient.subscriptions).forEach(id => runner.store.appSyncClient.subscriptions[id].disconnect()); | ||
Object.keys(runner.store.appSyncClient.subscriptions).forEach((id) => runner.store.appSyncClient.subscriptions[id].disconnect()); | ||
}; | ||
@@ -171,6 +171,6 @@ const getQuery = (store, client, userId) => { | ||
const checks = { | ||
null: fragment => chai_1.expect(fragment).to.equal(null), | ||
undefined: fragment => chai_1.expect(fragment).to.equal(undefined), | ||
true: fragment => chai_1.expect(fragment).to.equal(true), | ||
false: fragment => chai_1.expect(fragment).to.equal(false), | ||
null: (fragment) => chai_1.expect(fragment).to.equal(null), | ||
undefined: (fragment) => chai_1.expect(fragment).to.equal(undefined), | ||
true: (fragment) => chai_1.expect(fragment).to.equal(true), | ||
false: (fragment) => chai_1.expect(fragment).to.equal(false), | ||
}; | ||
@@ -177,0 +177,0 @@ checks[expected](jsonata(exp).evaluate(opResult)); |
@@ -23,4 +23,3 @@ "use strict"; | ||
body.items = body.items.filter((item) => item !== null); | ||
console.log(`filterOutNulls removed ${originalItemsCount - | ||
body.items.length} null items`); | ||
console.log(`filterOutNulls removed ${originalItemsCount - body.items.length} null items`); | ||
} | ||
@@ -27,0 +26,0 @@ return body; |
@@ -11,3 +11,3 @@ "use strict"; | ||
willRun: regexMatcher_1.regexMatcher(/^the Webhook Receiver "([^"]+)" should be called$/), | ||
run: async ([MessageGroupId], _, runner) => r.receiveWebhookRequest(MessageGroupId, runner).then(r => r.body), | ||
run: async ([MessageGroupId], _, runner) => r.receiveWebhookRequest(MessageGroupId, runner).then((r) => r.body), | ||
}, | ||
@@ -14,0 +14,0 @@ { |
{ | ||
"name": "@nrfcloud/bdd-feature-runner-aws", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "BDD Test Runner for cloud native applications made with AWS.", | ||
@@ -62,6 +62,6 @@ "main": "dist/index.js", | ||
"husky": "^1.3.1", | ||
"prettier": "^1.16.4", | ||
"prettier": "^2.0.5", | ||
"semantic-release": "^17.0.1", | ||
"tslint": "^5.15.0", | ||
"typescript": "^3.4.3" | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -68,0 +68,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
338844
9745