@gnuechtel/shared-e2e 1.0.0-beta.2 → 1.0.0-rc.2
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/README.md +3 -8
- package/package.json +5 -4
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/coverage-setup.js +1 -1
- package/src/lib/coverage-setup.js.map +1 -1
- package/src/lib/coverage-test-base.js +1 -1
- package/src/lib/coverage-test-base.js.map +1 -1
- package/src/lib/local-registry.d.ts +1 -0
- package/src/lib/local-registry.js +63 -0
- package/src/lib/local-registry.js.map +1 -0
package/README.md
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
# shared-e2e
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared end-to-end test functions for [gnuechtel](https://www.npmjs.com/org/gnuechtel) projects
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Run `nx build shared-e2e` to build the library.
|
|
8
|
-
|
|
9
|
-
## Running unit tests
|
|
10
|
-
|
|
11
|
-
Run `nx test shared-e2e` to execute the unit tests via [Jest](https://jestjs.io).
|
|
5
|
+
May contain useful functions for other projects too, but is not optimized for them.
|
|
6
|
+
Semantic versioning is also not guaranteed here.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnuechtel/shared-e2e",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"tslib": "^2.3.0",
|
|
12
|
-
"@gnuechtel/shared-coverage": "1.0.0-
|
|
13
|
-
"@gnuechtel/shared-util": "1.0.0-
|
|
12
|
+
"@gnuechtel/shared-coverage": "1.0.0-rc.2",
|
|
13
|
+
"@gnuechtel/shared-util": "1.0.0-rc.2",
|
|
14
14
|
"debug": "^4.3.4"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@playwright/test": "^1.38.0"
|
|
17
|
+
"@playwright/test": "^1.38.0",
|
|
18
|
+
"nx": "^16.0.0"
|
|
18
19
|
},
|
|
19
20
|
"type": "commonjs",
|
|
20
21
|
"main": "./src/index.js",
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./lib/coverage-setup"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./lib/coverage-test-base"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/local-registry"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/shared-e2e/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mEAAyC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/shared-e2e/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mEAAyC;AACzC,+DAAqC"}
|
|
@@ -6,7 +6,7 @@ const shared_coverage_1 = require("@gnuechtel/shared-coverage");
|
|
|
6
6
|
const shared_util_1 = require("@gnuechtel/shared-util");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
-
const debug = require('debug')('e2e:
|
|
9
|
+
const debug = require('debug')('e2e:coverage');
|
|
10
10
|
function coverageSetup() {
|
|
11
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
12
|
debug('coverageSetup - Deleting existing coverage files');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-setup.js","sourceRoot":"","sources":["../../../../../libs/shared-e2e/src/lib/coverage-setup.ts"],"names":[],"mappings":";;;;AAAA,gEAAkH;AAClH,wDAAuD;AACvD,6BAA6B;AAE7B,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"coverage-setup.js","sourceRoot":"","sources":["../../../../../libs/shared-e2e/src/lib/coverage-setup.ts"],"names":[],"mappings":";;;;AAAA,gEAAkH;AAClH,wDAAuD;AACvD,6BAA6B;AAE7B,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC;AAE/C,SAAsB,aAAa;;QACjC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAC1D,IAAA,uDAAqC,GAAE,CAAC;QACxC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,CAAC;CAAA;AAJD,sCAIC;AAED,SAAsB,gBAAgB,CAAC,sBAA+B;;QACpE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC5D,IAAI;YACF,MAAM,gBAAgB,GAAG,sBAAsB,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAC/E,MAAM,IAAA,+CAA6B,EAAC,IAAA,2BAAa,GAAE,EAAE,gBAAgB,CAAC,CAAC;YACvE,KAAK,CAAC,qDAAqD,CAAC,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,kEAAkE,EAAE,CAAC,CAAC,CAAC;SAC9E;IACH,CAAC;CAAA;AATD,4CASC"}
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const test_1 = require("@playwright/test");
|
|
6
6
|
const shared_coverage_1 = require("@gnuechtel/shared-coverage");
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
-
const debug = require('debug')('e2e:
|
|
8
|
+
const debug = require('debug')('e2e:coverage');
|
|
9
9
|
exports.test = test_1.test.extend({
|
|
10
10
|
context: ({ context }, use) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
yield (0, shared_coverage_1.prepareContextForIstanbulCoverage)(context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-test-base.js","sourceRoot":"","sources":["../../../../../libs/shared-e2e/src/lib/coverage-test-base.ts"],"names":[],"mappings":";;;;AAAA,2CAAgD;AAChD,gEAAkH;AAElH,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"coverage-test-base.js","sourceRoot":"","sources":["../../../../../libs/shared-e2e/src/lib/coverage-test-base.ts"],"names":[],"mappings":";;;;AAAA,2CAAgD;AAChD,gEAAkH;AAElH,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC;AAElC,QAAA,IAAI,GAAG,WAAI,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,CAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,IAAA,mDAAiC,EAAC,OAAO,CAAC,CAAC;QACjD,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;QACnB,IAAI;YACF,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACxC,MAAM,IAAA,mDAAiC,EAAC,OAAO,CAAC,CAAC;YACjD,KAAK,CAAC,+BAA+B,CAAC,CAAC;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,0CAA0C,EAAE,CAAC,CAAC,CAAC;SACtD;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startLocalRegistry(localRegistryTarget: string, storage: string): Promise<import("@gnuechtel/shared-util").Process>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startLocalRegistry = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const shared_util_1 = require("@gnuechtel/shared-util");
|
|
7
|
+
// Some duplicated code from here: https://github.com/nrwl/nx/blob/d36194ad17d36e8e12f517f30f5171f4af99d556/packages/js/src/plugins/jest/start-local-registry.ts
|
|
8
|
+
//
|
|
9
|
+
// With some changes:
|
|
10
|
+
//
|
|
11
|
+
// - require.resolve('nx/bin/nx')
|
|
12
|
+
// - registry state
|
|
13
|
+
// - usage of createProcess from util library
|
|
14
|
+
//
|
|
15
|
+
function startLocalRegistry(localRegistryTarget, storage) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
if (!localRegistryTarget) {
|
|
18
|
+
throw new Error(`localRegistryTarget is required`);
|
|
19
|
+
}
|
|
20
|
+
const name = 'Local registry';
|
|
21
|
+
const readyWhen = 'http://localhost:';
|
|
22
|
+
let port;
|
|
23
|
+
// We configure npm and yarn for local publishing after the local registry was started
|
|
24
|
+
const onReady = (readyMessage) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
if (!readyMessage)
|
|
27
|
+
throw new Error(`${name} is not ready!`);
|
|
28
|
+
// Detect port from server output
|
|
29
|
+
const portString = (_b = (_a = readyMessage.match(/localhost:(?<port>\d+)/)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b['port'];
|
|
30
|
+
if (!portString)
|
|
31
|
+
throw new Error('Could not detect port');
|
|
32
|
+
port = parseInt(portString);
|
|
33
|
+
console.log(`${name} started on port ${port}`);
|
|
34
|
+
// Configure npm
|
|
35
|
+
const registry = `http://localhost:${port}`;
|
|
36
|
+
process.env['npm_config_registry'] = registry;
|
|
37
|
+
(0, child_process_1.execSync)(`npm config set //localhost:${port}/:_authToken "secretVerdaccioToken"`);
|
|
38
|
+
// Configure yarn 1 and yarn 2
|
|
39
|
+
process.env['YARN_REGISTRY'] = registry;
|
|
40
|
+
process.env['YARN_NPM_REGISTRY_SERVER'] = registry;
|
|
41
|
+
process.env['YARN_UNSAFE_HTTP_WHITELIST'] = 'localhost';
|
|
42
|
+
console.log(`Set npm and yarn config registry to ${registry}`);
|
|
43
|
+
};
|
|
44
|
+
// We delete the local npm configuration before the local registry will be stopped
|
|
45
|
+
const onStopping = () => (0, child_process_1.execSync)(`npm config delete //localhost:${port}/:_authToken`);
|
|
46
|
+
// We write a log message after the local registry was stopped
|
|
47
|
+
const onStopped = () => console.log(`${name} stopped successfully`);
|
|
48
|
+
return yield (0, shared_util_1.createProcess)(require.resolve('nx/bin/nx'), [
|
|
49
|
+
...`run ${localRegistryTarget} --location none --clear true`.split(' '),
|
|
50
|
+
...(storage ? [`--storage`, storage] : []),
|
|
51
|
+
], {
|
|
52
|
+
name,
|
|
53
|
+
readyWhen,
|
|
54
|
+
onReady,
|
|
55
|
+
onStopping,
|
|
56
|
+
onStopped,
|
|
57
|
+
background: false,
|
|
58
|
+
useFork: true,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.startLocalRegistry = startLocalRegistry;
|
|
63
|
+
//# sourceMappingURL=local-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-registry.js","sourceRoot":"","sources":["../../../../../libs/shared-e2e/src/lib/local-registry.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,wDAAuD;AAEvD,gKAAgK;AAChK,EAAE;AACF,qBAAqB;AACrB,EAAE;AACF,iCAAiC;AACjC,mBAAmB;AACnB,6CAA6C;AAC7C,EAAE;AACF,SAAsB,kBAAkB,CAAC,mBAA2B,EAAE,OAAe;;QACnF,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QAED,MAAM,IAAI,GAAG,gBA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