@brillout/test-e2e 0.5.23 → 0.5.25

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/Logs.js CHANGED
@@ -92,7 +92,7 @@ function expectLog(logText, logFilter) {
92
92
  const logsFoundWithFilter = logsFound.filter((logEntry) => logFilter?.(removeAnsi(logEntry)));
93
93
  if (logsFoundWithFilter.length === 0) {
94
94
  if (logsFound.length === 0) {
95
- throw new Error(`The following log was expected but wasn't logged: "${logText}"`);
95
+ throw new Error(`The following log was expected but it wasn't logged: "${logText}"`);
96
96
  }
97
97
  else {
98
98
  throw new Error(`The following log was logged as expected, but it didn't match the logFilter() you provided`);
package/dist/cli.js CHANGED
@@ -30,7 +30,9 @@ function initUserExitHandler() {
30
30
  Logs_1.Logs.flushLogs();
31
31
  });
32
32
  }
33
- // Much simpler alternative: https://github.com/brillout/vite-plugin-ssr/blob/77b1b0e8b6c1ed4efe3e3039f7c0b23a00651663/vite-plugin-ssr/node/plugin/plugins/importUserCode/v1-design/transpileAndLoadFile.ts#L200-L208
33
+ // This mechanism seems necessary for the source map to apply for errors that happen a long time after the build file, which contains the inline source map, is removed.
34
+ // - The much simpler alternative used by Vike doesn't seem to work: https://github.com/brillout/vite-plugin-ssr/blob/77b1b0e8b6c1ed4efe3e3039f7c0b23a00651663/vite-plugin-ssr/node/plugin/plugins/importUserCode/v1-design/transpileAndLoadFile.ts#L200-L208
35
+ // - Failed attempt to make the simpler alternative work: https://github.com/brillout/test-e2e/commit/681abd19459b8c7d3ade9363ba32be86e3fdcb53
34
36
  function initSourceMap() {
35
37
  source_map_support_1.default.install({
36
38
  retrieveSourceMap: function (source) {
@@ -3,6 +3,7 @@ export { logWarn };
3
3
  export { logFail };
4
4
  export { logBoot };
5
5
  export { hasFail };
6
+ export declare const TEST_FAIL = "TEST_FAIL";
6
7
  declare function logPass(): void;
7
8
  declare function logWarn(warning: string): void;
8
9
  declare function logFail(reason: string, isFinalAttempt: boolean): void;
@@ -3,7 +3,8 @@ 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.hasFail = exports.logBoot = exports.logFail = exports.logWarn = exports.logPass = void 0;
6
+ exports.TEST_FAIL = exports.hasFail = exports.logBoot = exports.logFail = exports.logWarn = exports.logPass = void 0;
7
+ exports.TEST_FAIL = 'TEST_FAIL';
7
8
  const getCurrentTest_1 = require("./getCurrentTest");
8
9
  const utils_1 = require("./utils");
9
10
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
@@ -24,7 +25,7 @@ function logFail(reason, isFinalAttempt) {
24
25
  }
25
26
  const { FAIL } = getStatusTags();
26
27
  const color = (s) => picocolors_1.default.red(picocolors_1.default.bold(s));
27
- const msg = `Test ${isFinalAttempt ? FAIL : 'failed'} because ${reason}, see below. [TEST_FAILURE]`;
28
+ const msg = `Test ${isFinalAttempt ? FAIL : 'failed'} because ${reason}, see below. [${exports.TEST_FAIL}]`;
28
29
  console.log(color(msg));
29
30
  }
30
31
  exports.logFail = logFail;
package/dist/runAll.js CHANGED
@@ -30,8 +30,8 @@ async function runAll(filter) {
30
30
  (0, utils_1.assert)(hasFailedTestFile && hasFailLog);
31
31
  (0, utils_1.assert)(failedTestFiles.length > 0);
32
32
  throw new Error(picocolors_1.default.red(picocolors_1.default.bold([
33
- 'Following test files failed, see logs above for more information (search for [TEST_FAILURE]):',
34
- ...failedTestFiles.map((testFile) => ` ${testFile}`),
33
+ `Following test files failed, see logs above for more information (search for [${logTestStatus_1.TEST_FAIL}]):`,
34
+ ...failedTestFiles.map((testFile) => `❌ ${testFile}`),
35
35
  ].join('\n'))));
36
36
  }
37
37
  }
@@ -74,14 +74,15 @@ async function runTestFiles(testFiles, browser) {
74
74
  }
75
75
  async function buildAndTest(testFile, browser, isThirdAttempt) {
76
76
  (0, utils_1.assert)(testFile.endsWith('.ts'));
77
- const testFileJs = testFile.replace('.ts', '.mjs');
77
+ const cacheBuster = Date.now();
78
+ const testFileJs = testFile.replace('.ts', `.${cacheBuster}.mjs`);
78
79
  (0, utils_1.assert)(testFileJs.endsWith('.mjs'));
79
80
  const cleanBuild = await (0, buildTs_1.buildTs)(testFile, testFileJs);
80
81
  (0, getCurrentTest_2.setCurrentTest)(testFile);
81
82
  (0, logTestStatus_1.logBoot)();
82
83
  let execErr;
83
84
  try {
84
- await import((0, utils_2.fsWindowsBugWorkaround)(testFileJs) + `?cacheBuster=${Date.now()}`);
85
+ await import((0, utils_2.fsWindowsBugWorkaround)(testFileJs));
85
86
  }
86
87
  catch (err) {
87
88
  (0, utils_1.assert)(err);
@@ -17,7 +17,7 @@ async function testScreenshotFixture({ screenshotFixturePath, doNotTestLocally,
17
17
  const pngPaths = getPngPaths();
18
18
  const pngFixturPath = screenshotFixturePath || pngPaths.pngFixturPath;
19
19
  if (doNotTestLocally && !(0, utils_1.isCI)()) {
20
- console.log(`${picocolors_1.default.blue(picocolors_1.default.bold('INFO'))} screenshot test ${pngFixturPath} skipped because running test locally (i.e. not in a CI environment)`);
20
+ console.log(`\n${picocolors_1.default.blue(picocolors_1.default.bold('INFO'))} screenshot test ${pngFixturPath} skipped because running test locally (i.e. not in a CI environment)`);
21
21
  return;
22
22
  }
23
23
  if (!fs_1.default.existsSync(pngFixturPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.5.23",
3
+ "version": "0.5.25",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {