k6-cucumber-steps 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
1
  module.exports = function buildK6Script(config) {
2
- const { method, endpoints, endpoint, body, headers, options } = config;
2
+ const { method, endpoints, endpoint, body, headers, options, baseUrl } = config;
3
3
 
4
- if (!endpoints?.length && !endpoint) {
5
- throw new Error(
6
- 'Either "endpoints" or "endpoint" must be defined in the configuration.'
7
- );
8
- }
4
+ // Prefer baseUrl from config (set by step/world), then env
5
+ const BASE_URL =
6
+ baseUrl ||
7
+ (config.worldParameters && config.worldParameters.baseUrl) ||
8
+ process.env.API_BASE_URL ||
9
+ process.env.BASE_URL;
9
10
 
10
- const BASE_URL = process.env.API_BASE_URL || process.env.BASE_URL;
11
11
  if (!BASE_URL) {
12
12
  throw new Error(
13
- "Neither API_BASE_URL nor BASE_URL is defined in the environment variables."
13
+ "No base URL found: please provide baseUrl inline (step/world/feature) or set API_BASE_URL/BASE_URL in environment variables."
14
14
  );
15
15
  }
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k6-cucumber-steps",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "repository": {