@brillout/test-e2e 0.1.6 → 0.1.7

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/dist/buildTs.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { buildTs };
2
+ export { sourceMaps };
3
+ declare const sourceMaps: Record<string, string>;
2
4
  declare function buildTs(entry: string, outfile: string): Promise<() => void>;
package/dist/buildTs.js CHANGED
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildTs = void 0;
6
+ exports.sourceMaps = exports.buildTs = void 0;
7
7
  const esbuild_1 = __importDefault(require("esbuild"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const utils_1 = require("./utils");
10
+ const sourceMaps = {};
11
+ exports.sourceMaps = sourceMaps;
10
12
  async function buildTs(entry, outfile) {
11
13
  await esbuild_1.default.build({
12
14
  platform: 'node',
@@ -20,12 +22,16 @@ async function buildTs(entry, outfile) {
20
22
  external: ['./node_modules/*', '@brillout/test-e2e'],
21
23
  minify: false,
22
24
  });
25
+ {
26
+ const sourceMapFile = `${outfile}.map`;
27
+ sourceMaps[outfile] = fs_1.default.readFileSync(sourceMapFile, 'utf8');
28
+ fs_1.default.unlinkSync(sourceMapFile);
29
+ }
23
30
  const clean = () => {
24
31
  if (utils_1.cliConfig.debugEsbuild) {
25
32
  return;
26
33
  }
27
34
  fs_1.default.unlinkSync(`${outfile}`);
28
- fs_1.default.unlinkSync(`${outfile}.map`);
29
35
  };
30
36
  return clean;
31
37
  }
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
- import 'source-map-support/register';
1
+ export {};
package/dist/cli.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // @ts-ignore
4
- require("source-map-support/register");
6
+ const source_map_support_1 = __importDefault(require("source-map-support"));
5
7
  const utils_1 = require("./utils");
6
8
  const runTestSuites_1 = require("./runTestSuites");
9
+ const buildTs_1 = require("./buildTs");
10
+ initSourceMap();
7
11
  initPromiseRejectionHandler();
8
12
  cli();
9
13
  function cli() {
@@ -16,3 +20,20 @@ function initPromiseRejectionHandler() {
16
20
  process.exit(1);
17
21
  });
18
22
  }
23
+ function initSourceMap() {
24
+ source_map_support_1.default.install({
25
+ retrieveSourceMap: function (source) {
26
+ const prefix = utils_1.fsWindowsBugWorkaroundPrefix;
27
+ if (source.startsWith(prefix)) {
28
+ source = source.slice(prefix.length);
29
+ }
30
+ let sourceMap = buildTs_1.sourceMaps[source];
31
+ if (sourceMap) {
32
+ return {
33
+ map: sourceMap,
34
+ };
35
+ }
36
+ return null;
37
+ },
38
+ });
39
+ }
@@ -16,7 +16,7 @@ async function runTestSuites(filter) {
16
16
  const clean = await (0, buildTs_1.buildTs)(testFile, testFileJs);
17
17
  (0, getCurrentTest_1.setCurrentTest)(testFile);
18
18
  try {
19
- await import(workaroundBug(testFileJs));
19
+ await import((0, utils_1.fsWindowsBugWorkaround)(testFileJs));
20
20
  }
21
21
  finally {
22
22
  clean();
@@ -28,7 +28,3 @@ async function runTestSuites(filter) {
28
28
  await browser.close();
29
29
  }
30
30
  exports.runTestSuites = runTestSuites;
31
- // https://stackoverflow.com/questions/69665780/error-err-unsupported-esm-url-scheme-only-file-and-data-urls-are-supported-by/70057245#70057245
32
- function workaroundBug(testFileJs) {
33
- return `file://${testFileJs}`;
34
- }
package/dist/runTests.js CHANGED
@@ -42,7 +42,7 @@ async function runTests(browser) {
42
42
  logSource: 'test()',
43
43
  logText: testDesc,
44
44
  });
45
- const done = (0, utils_1.logProgress)(` | [test] ${testDesc}`);
45
+ const done = (0, utils_1.logProgress)(`| [test] ${testDesc}`);
46
46
  let err;
47
47
  try {
48
48
  await runTest(testFn, testInfo.runInfo.testTimeout);
@@ -102,9 +102,9 @@ function runTest(testFn, testTimeout) {
102
102
  }
103
103
  function logTestsResult(success) {
104
104
  const testInfo = (0, getCurrentTest_1.getCurrentTest)();
105
- const passStyle = (t) => (0, picocolors_1.white)((0, picocolors_1.bgGreen)(t));
106
- const failStyle = (t) => (0, picocolors_1.white)((0, picocolors_1.bgRed)(t));
107
- const skipStyle = (t) => (0, picocolors_1.white)((0, picocolors_1.bgYellow)(t));
105
+ const passStyle = (t) => (0, picocolors_1.bold)((0, picocolors_1.white)((0, picocolors_1.bgGreen)(t)));
106
+ const failStyle = (t) => (0, picocolors_1.bold)((0, picocolors_1.white)((0, picocolors_1.bgRed)(t)));
107
+ const skipStyle = (t) => (0, picocolors_1.bold)((0, picocolors_1.white)((0, picocolors_1.bgYellow)(t)));
108
108
  if (success) {
109
109
  (0, utils_1.assert)(!testInfo.skipped);
110
110
  console.log(`${passStyle('PASS')} ${testInfo.testFile}`);
package/dist/setup.js CHANGED
@@ -118,7 +118,7 @@ function getRunInfo() {
118
118
  }
119
119
  async function start() {
120
120
  const { cmd, additionalTimeout, serverIsReadyMessage, serverIsReadyDelay } = getRunInfo();
121
- const done = (0, utils_1.logProgress)(` | [run] ${cmd}`);
121
+ const done = (0, utils_1.logProgress)(`| [run] ${cmd}`);
122
122
  let hasSuccessfullyStarted = false;
123
123
  let resolveServerStart;
124
124
  let rejectServerStart;
@@ -0,0 +1,4 @@
1
+ export { fsWindowsBugWorkaround };
2
+ export { fsWindowsBugWorkaroundPrefix };
3
+ declare const fsWindowsBugWorkaroundPrefix = "file://";
4
+ declare function fsWindowsBugWorkaround(testFileJs: string): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fsWindowsBugWorkaroundPrefix = exports.fsWindowsBugWorkaround = void 0;
4
+ const fsWindowsBugWorkaroundPrefix = 'file://';
5
+ exports.fsWindowsBugWorkaroundPrefix = fsWindowsBugWorkaroundPrefix;
6
+ // https://stackoverflow.com/questions/69665780/error-err-unsupported-esm-url-scheme-only-file-and-data-urls-are-supported-by/70057245#70057245
7
+ function fsWindowsBugWorkaround(testFileJs) {
8
+ return `${fsWindowsBugWorkaroundPrefix}${testFileJs}`;
9
+ }
10
+ exports.fsWindowsBugWorkaround = fsWindowsBugWorkaround;
@@ -6,3 +6,4 @@ export * from './isTTY';
6
6
  export * from './findFiles';
7
7
  export * from './logProgress';
8
8
  export * from './cliConfig';
9
+ export * from './fsWindowsBugWorkaround';
@@ -22,3 +22,4 @@ __exportStar(require("./isTTY"), exports);
22
22
  __exportStar(require("./findFiles"), exports);
23
23
  __exportStar(require("./logProgress"), exports);
24
24
  __exportStar(require("./cliConfig"), exports);
25
+ __exportStar(require("./fsWindowsBugWorkaround"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -27,6 +27,7 @@
27
27
  "@types/chai": "^4.3.3",
28
28
  "@types/node": "^15.6.1",
29
29
  "@types/node-fetch": "^2.5.12",
30
+ "@types/source-map-support": "^0.5.6",
30
31
  "typescript": "^4.8.3"
31
32
  },
32
33
  "repository": "github:brillout/test-e2e",