@serenity-js/core 3.1.6 → 3.2.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.2.0](https://github.com/serenity-js/serenity-js/compare/v3.1.6...v3.2.0) (2023-05-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **core:** use "types" instead of "typings" in package.json files ([b83d922](https://github.com/serenity-js/serenity-js/commit/b83d922076242c6cd5d6f2da055a05aa5e77f11b)), closes [#1682](https://github.com/serenity-js/serenity-js/issues/1682)
12
+
13
+
14
+ ### Features
15
+
16
+ * **core:** introduced support for Node.js 20, dropped support for Node.js 14 ([491fef8](https://github.com/serenity-js/serenity-js/commit/491fef8df672a2b40d247887b3da409dccbd26fd)), closes [#1678](https://github.com/serenity-js/serenity-js/issues/1678)
17
+ * **core:** new factory method to create Path.fromURI ([baed8c4](https://github.com/serenity-js/serenity-js/commit/baed8c4a86a2d7b114783574c2326d8102c1b0e9))
18
+
19
+
20
+
21
+
22
+
6
23
  ## [3.1.6](https://github.com/serenity-js/serenity-js/compare/v3.1.5...v3.1.6) (2023-04-18)
7
24
 
8
25
 
package/README.md CHANGED
@@ -5,16 +5,23 @@
5
5
  [![Join Serenity/JS Community Chat](https://img.shields.io/badge/Chat-Serenity%2FJS%20Community-FBD30B?logo=matrix)](https://matrix.to/#/#serenity-js:gitter.im)
6
6
  [![Support Serenity/JS on GitHub](https://img.shields.io/badge/Support-@serenity--js-703EC8?logo=github)](https://github.com/sponsors/serenity-js)
7
7
 
8
- [Serenity/JS](https://serenity-js.org) is an innovative framework designed to make acceptance and regression testing
8
+ [Serenity/JS](https://serenity-js.org) is an innovative open-source framework designed to make acceptance and regression testing
9
9
  of complex software systems faster, more collaborative and easier to scale.
10
10
 
11
- To get started, check out the comprehensive [Serenity/JS Handbook](https://serenity-js.org/handbook), [API documentation](https://serenity-js.org/api/core), and [Serenity/JS project templates on GitHub](https://serenity-js.org/handbook/getting-started#serenityjs-project-templates).
11
+ ⭐️ Get started with Serenity/JS!
12
+ - [Serenity/JS Handbook](https://serenity-js.org/handbook) and [tutorial](https://serenity-js.org/handbook/web-testing/your-first-web-scenario),
13
+ - [API documentation](https://serenity-js.org/api/core),
14
+ - [Serenity/JS project templates on GitHub](https://serenity-js.org/handbook/getting-started#serenityjs-project-templates).
12
15
 
13
- If you have any questions or just want to say hello, join the [Serenity/JS Community Chat](https://matrix.to/#/#serenity-js:gitter.im).
16
+ 👋 Join the Serenity/JS Community!
17
+ - Meet other Serenity/JS developers and maintainers on the [Serenity/JS Community chat channel](https://matrix.to/#/#serenity-js:gitter.im),
18
+ - Find answers to your Serenity/JS questions on the [Serenity/JS Forum](https://github.com/orgs/serenity-js/discussions/categories/how-do-i),
19
+ - Learn how to [contribute to Serenity/JS](https://serenity-js.org/contributing),
20
+ - Support the project and gain access to [Serenity/JS Playbooks](https://github.com/serenity-js/playbooks) by becoming a [Serenity/JS GitHub Sponsor](https://github.com/sponsors/serenity-js)!
14
21
 
15
22
  ## Serenity/JS Core
16
23
 
17
- [`@serenity-js/core`](https://serenity-js.org/modules/core/) is the heart of the [Serenity/JS](https://serenity-js.org) framework.
24
+ [`@serenity-js/core`](https://serenity-js.org/api/core/) is the heart of the [Serenity/JS](https://serenity-js.org) framework.
18
25
  It enables you to configure the framework, manage actors, and provides basic building blocks
19
26
  to help you design high-quality acceptance tests.
20
27
 
@@ -25,3 +32,21 @@ To install this module, run the following command in your computer terminal:
25
32
  ```
26
33
  npm install --save-dev @serenity-js/core
27
34
  ```
35
+
36
+ ## 📣 Stay up to date
37
+
38
+ New features, tutorials, and demos are coming soon!
39
+ Follow [Serenity/JS on LinkedIn](https://www.linkedin.com/company/serenity-js),
40
+ subscribe to [Serenity/JS channel on YouTube](https://www.youtube.com/@serenity-js) and join the [Serenity/JS Community Chat](https://matrix.to/#/#serenity-js:gitter.im) to stay up to date!
41
+ Please also make sure to star ⭐️ [Serenity/JS on GitHub](https://github.com/serenity-js/serenity-js) to help others discover the framework!
42
+
43
+ [![Follow Serenity/JS on LinkedIn](https://img.shields.io/badge/Follow-Serenity%2FJS%20-0077B5?logo=linkedin)](https://www.linkedin.com/company/serenity-js)
44
+ [![Watch Serenity/JS on YouTube](https://img.shields.io/badge/Watch-@serenity--js-E62117?logo=youtube)](https://www.youtube.com/@serenity-js)
45
+ [![Join Serenity/JS Community Chat](https://img.shields.io/badge/Chat-Serenity%2FJS%20Community-FBD30B?logo=matrix)](https://matrix.to/#/#serenity-js:gitter.im)
46
+ [![GitHub stars](https://img.shields.io/github/stars/serenity-js/serenity-js?label=Serenity%2FJS&logo=github&style=badge)](https://github.com/serenity-js/serenity-js)
47
+
48
+ ## 💛 Support Serenity/JS
49
+
50
+ If you appreciate all the effort that goes into making sophisticated tools easy to work with, please support our work and become a Serenity/JS GitHub Sponsor today!
51
+
52
+ [![GitHub Sponsors](https://img.shields.io/badge/Support%20@serenity%2FJS-703EC8?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sponsors/serenity-js)
package/lib/io/Path.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare class Path extends TinyType {
3
3
  private static readonly Separator;
4
4
  readonly value: string;
5
5
  static fromJSON(v: string): Path;
6
+ static fromURI(uri: string): Path;
6
7
  static from(...segments: string[]): Path;
7
8
  static fromSanitisedString(value: string): Path;
8
9
  constructor(value: string);
@@ -1 +1 @@
1
- {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/io/Path.ts"],"names":[],"mappings":"AACA,OAAO,EAA8C,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGlF,qBAAa,IAAK,SAAQ,QAAQ;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAO;IACxC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAE9B,MAAM,CAAC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AAI,IAAI;IAIjB,QAAQ,IAAI,MAAM;IAIlB,UAAU,IAAI,OAAO;IAIrB,IAAI,IAAI,IAAI;CAGf"}
package/lib/io/Path.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -6,11 +29,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
29
  exports.Path = void 0;
7
30
  const filenamify_1 = __importDefault(require("filenamify"));
8
31
  const tiny_types_1 = require("tiny-types");
9
- const upath_1 = __importDefault(require("upath"));
32
+ const upath_1 = __importStar(require("upath"));
10
33
  class Path extends tiny_types_1.TinyType {
11
34
  static fromJSON(v) {
12
35
  return new Path(v);
13
36
  }
37
+ static fromURI(uri) {
38
+ // inspired by https://github.com/TooTallNate/file-uri-to-path
39
+ if (typeof uri !== 'string' ||
40
+ uri.length <= 7 ||
41
+ uri.slice(0, 7) !== 'file://') {
42
+ throw new TypeError(`A Path can be created only from URIs that start with 'file://'. Received: ${uri}`);
43
+ }
44
+ const rest = decodeURI(uri.slice(7));
45
+ const firstSlash = rest.indexOf('/');
46
+ let host = rest.slice(0, Math.max(0, firstSlash));
47
+ // 2. Scheme Definition
48
+ // As a special case, <host> can be the string "localhost" or the empty
49
+ // string; this is interpreted as "the machine from which the URL is being interpreted".
50
+ if (host === 'localhost') {
51
+ host = '';
52
+ }
53
+ if (host) {
54
+ host = upath_1.sep + upath_1.sep + host;
55
+ }
56
+ let path = rest.slice(Math.max(0, firstSlash + 1));
57
+ // Drives, drive letters, mount points, file system root
58
+ //
59
+ // Drive letters are mapped into the top of a file URI in various ways, depending on the implementation;
60
+ // some applications substitute vertical bar ("|") for the colon after the drive letter,
61
+ // yielding "file:///c|/tmp/test.txt".
62
+ // In some cases, the colon is left unchanged, as in "file:///c:/tmp/test.txt".
63
+ // In other cases, the colon is simply omitted, as in "file:///c/tmp/test.txt".
64
+ path = path.replace(/^(.+)\|/, '$1:');
65
+ // for Windows, we need to invert the path separators from what a URI uses
66
+ if (upath_1.sep === '\\') {
67
+ throw new Error('that used?');
68
+ // path = path.replace(/\//g, '\\');
69
+ }
70
+ if (!(/^.+:/.test(path))) {
71
+ // unix path, because there's no Windows drive at the beginning
72
+ path = upath_1.sep + path;
73
+ }
74
+ return new Path(host + path);
75
+ }
14
76
  static from(...segments) {
15
77
  return new Path(upath_1.default.joinSafe(...segments));
16
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Path.js","sourceRoot":"","sources":["../../src/io/Path.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,2CAAkF;AAClF,kDAAyB;AAEzB,MAAa,IAAK,SAAQ,qBAAQ;IAI9B,MAAM,CAAC,QAAQ,CAAC,CAAS;QACrB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,QAAkB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AE,MAAM,EACF,gBAAgB,EAAE,CAC/B,gBAAgB,EAAE;SAAI,KAAK,IAAI,MAAM,MAAM,GAAI,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAAE,EAC/E,GAAG,IAAI,EAAE;SAAI,KAAK,IAAI,MAAM,MAAM,GAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAAE,KAC9D,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EACR,MAAM,EAAE,MAAM;IAKnC;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuC9F"}
@@ -79,7 +79,6 @@ class Debug extends Interaction_1.Interaction {
79
79
  * @param values
80
80
  */
81
81
  static values(debuggerFunction, ...values) {
82
- /* istanbul ignore next can't test using a debugger in an automated test */
83
82
  return new Debug(`#actor debugs ${values.length} values`, debuggerFunction, values);
84
83
  }
85
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Debug.js","sourceRoot":"","sources":["../../../src/screenplay/debugging/Debug.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAC/C,iCAA6B;AAC7B,sDAAmD;AACnD,uCAA6C;AAK7C,gDAA6C;AAI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,KAAiD,SAAQ,yBAAW;IAE7E;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAA4C,gBAGhC,EAAE,GAAG,MAAc;QACxC,2EAA2E;QAC3E,OAAO,IAAI,KAAK,CACZ,iBAAkB,MAAM,CAAC,MAAO,SAAS,EACzC,gBAAgB,EAChB,MAAM,CACT,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACH,YACI,WAAmB,EACF,gBAGQ,EACR,MAAc;QAE/B,KAAK,CAAC,WAAW,CAAC,CAAC;QANF,qBAAgB,GAAhB,gBA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AC,KAAK,CAAC;wBACzC,CAAC,CAAC,MAAM,CAAC,KAAK;iBACrB,CAAC;aACL,CAAC,EACF,IAAI,YAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAC/B,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACxB;QAED,IAAI,CAAC,gBAAgB,CACjB,OAAO,EACP,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAA2D,CACnG,CAAC;IACN,CAAC;CACJ;AAtFD,sBAsFC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenity-js/core",
3
- "version": "3.1.6",
3
+ "version": "3.2.0",
4
4
  "description": "Serenity/JS Screenplay, reporting engine and core interfaces.",
5
5
  "author": {
6
6
  "name": "Jan Molak",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "main": "lib/index.js",
19
- "typings": "lib/index.d.ts",
19
+ "types": "lib/index.d.ts",
20
20
  "keywords": [
21
21
  "bdd",
22
22
  "tdd",
@@ -27,7 +27,8 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "clean": "rimraf target",
30
- "test": "nyc mocha --config ../../.mocharc.yml 'spec/**/*.spec.*'",
30
+ "test": "c8 npm run test:no-coverage",
31
+ "test:no-coverage": "mocha --config ../../.mocharc.yml 'spec/**/*.spec.*'",
31
32
  "compile": "rimraf lib && tsc --project tsconfig.build.json"
32
33
  },
33
34
  "dependencies": {
@@ -52,10 +53,10 @@
52
53
  "@types/semver": "^7.3.13",
53
54
  "@types/validate-npm-package-name": "^4.0.0",
54
55
  "assertion-error-formatter": "^3.0.0",
56
+ "c8": "7.13.0",
55
57
  "memfs": "^3.5.0",
56
58
  "mocha": "^10.2.0",
57
59
  "mocha-multi": "^1.1.7",
58
- "nyc": "15.1.0",
59
60
  "ts-node": "^10.9.1",
60
61
  "typescript": "^5.0.4"
61
62
  },
@@ -68,8 +69,7 @@
68
69
  "url": "https://github.com/serenity-js/serenity-js/issues"
69
70
  },
70
71
  "engines": {
71
- "node": "^14 || ^16 || ^18",
72
- "npm": "^6 || ^7 || ^8 || ^9"
72
+ "node": "^16.13 || ^18.12 || ^20"
73
73
  },
74
- "gitHead": "825ecf4f0dd507e78da8b0634f659ecd3ddfb976"
74
+ "gitHead": "e69cea764f50991c3ad742f28926b4345b3e2422"
75
75
  }
package/src/io/Path.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import filenamify from 'filenamify';
2
2
  import { ensure, isDefined, isGreaterThan, property, TinyType } from 'tiny-types';
3
- import path from 'upath';
3
+ import path, { sep } from 'upath';
4
4
 
5
5
  export class Path extends TinyType {
6
6
  private static readonly Separator = '/';
@@ -10,6 +10,59 @@ export class Path extends TinyType {
10
10
  return new Path(v);
11
11
  }
12
12
 
13
+ static fromURI(uri: string): Path {
14
+ // inspired by https://github.com/TooTallNate/file-uri-to-path
15
+ if (
16
+ typeof uri !== 'string' ||
17
+ uri.length <= 7 ||
18
+ uri.slice(0, 7) !== 'file://'
19
+ ) {
20
+ throw new TypeError(
21
+ `A Path can be created only from URIs that start with 'file://'. Received: ${ uri }`
22
+ );
23
+ }
24
+
25
+ const rest = decodeURI(uri.slice(7));
26
+ const firstSlash = rest.indexOf('/');
27
+
28
+ let host = rest.slice(0, Math.max(0, firstSlash));
29
+
30
+ // 2. Scheme Definition
31
+ // As a special case, <host> can be the string "localhost" or the empty
32
+ // string; this is interpreted as "the machine from which the URL is being interpreted".
33
+ if (host === 'localhost') {
34
+ host = '';
35
+ }
36
+
37
+ if (host) {
38
+ host = sep + sep + host;
39
+ }
40
+
41
+ let path = rest.slice(Math.max(0, firstSlash + 1));
42
+
43
+ // Drives, drive letters, mount points, file system root
44
+ //
45
+ // Drive letters are mapped into the top of a file URI in various ways, depending on the implementation;
46
+ // some applications substitute vertical bar ("|") for the colon after the drive letter,
47
+ // yielding "file:///c|/tmp/test.txt".
48
+ // In some cases, the colon is left unchanged, as in "file:///c:/tmp/test.txt".
49
+ // In other cases, the colon is simply omitted, as in "file:///c/tmp/test.txt".
50
+ path = path.replace(/^(.+)\|/, '$1:');
51
+
52
+ // for Windows, we need to invert the path separators from what a URI uses
53
+ if (sep === '\\') {
54
+ throw new Error('that used?')
55
+ // path = path.replace(/\//g, '\\');
56
+ }
57
+
58
+ if (! (/^.+:/.test(path))) {
59
+ // unix path, because there's no Windows drive at the beginning
60
+ path = sep + path;
61
+ }
62
+
63
+ return new Path(host + path);
64
+ }
65
+
13
66
  static from(...segments: string[]): Path {
14
67
  return new Path(path.joinSafe(...segments));
15
68
  }
@@ -87,7 +87,6 @@ export class Debug<Values extends Array<Answerable<unknown>>> extends Interactio
87
87
  results: { [ Index in keyof Values ]: DebuggingResult<Values[Index]> },
88
88
  ...answers: { [ Index in keyof Values ]: Answered<Values[Index]> }
89
89
  ) => Promise<void> | void, ...values: Values): Interaction {
90
- /* istanbul ignore next can't test using a debugger in an automated test */
91
90
  return new Debug<Values>(
92
91
  `#actor debugs ${ values.length } values`,
93
92
  debuggerFunction,