sxy-test-runner 1.4.0 → 1.4.1

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.
@@ -67,7 +67,7 @@ export async function runTests(config, testFiles, failingTests, customOut = unde
67
67
  // wait for the output to complete
68
68
  await Promise.allObj(testRunOutPromises);
69
69
  });
70
- await timeProfileAsync('show initial test run results', async () => {
70
+ return await timeProfileAsync('show initial test run results', async () => {
71
71
  const out = customOut ? async (...texts) => await customOut(...texts) : async (...texts) => await mainOut(...texts);
72
72
  const testsResultsSummary = {
73
73
  total: 0,
@@ -139,5 +139,9 @@ export async function runTests(config, testFiles, failingTests, customOut = unde
139
139
  }
140
140
  await out(chalk.orange`To do: account for tests with loading errors`);
141
141
  // out(``)
142
+
143
+ // full success?
144
+ // true/false gets returned to the caller of runTests()
145
+ return testsResultsSummary.itsPasses === testsResultsSummary.itsTotal;
142
146
  });
143
147
  }
package/dist/cli/once.js CHANGED
@@ -31,10 +31,13 @@ export async function once() {
31
31
  const {
32
32
  runTests
33
33
  } = await import('./lib/runTests.js');
34
+ let exitCode = 2;
34
35
  if (testFiles.length > 0) {
35
36
  await log(chalk.brightblue`running tests...`);
36
- await runTests(config, testFiles, []); //// async function, run in thread
37
+ const testsResult = await runTests(config, testFiles, []); //// async function, run in thread
38
+ exitCode = testsResult ? 0 : 3;
37
39
  }
38
40
  const time = (await new Date().getTime()) - startTime;
39
41
  await out(chalk.grey`\n${await time.toLocaleString()}ms\n`);
42
+ await process.exit(exitCode);
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sxy-test-runner",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/RobertSandiford/sxy-test-runner",
6
6
  "repository": {
package/readme.md CHANGED
@@ -124,12 +124,6 @@ No option to re-run all tests on changes is currently available - I may add this
124
124
 
125
125
  Default behaviour is to re-run any failing test any time a change is made, even if that change isn't relevant to the failing test. This is to ensure you can see where attention is needed. Turn this off in the config if it is not convenient for you: config.watch.reRunFailingTests
126
126
 
127
- ## Reloading modules
128
-
129
- A key challenge in creating an ESM test runner is re-loading modules due to the engine not letting us clear the import cache of ESM modules. This framework relies on sxy-loader, which uses a babel transform to transform modules into a reloadable format with a controllable cache. A cache of transformed code is kept to keep the process speedy.
130
-
131
- Performance is a little less than a native module import, but not so much as to be notable inconvenience. Re-running only test related to changes keep performance strong even in very large projects.
132
-
133
127
  # Advanced usage
134
128
 
135
129
  ## 1. Run tasks at startup - setup
@@ -201,6 +195,9 @@ describe('something', ({it, beforeEachTest, afterEachTest, afterDescribe}) => {
201
195
 
202
196
  ```
203
197
 
204
- # Known issues
198
+ # Exit codes for `once`
205
199
 
206
- sxy-loader effectively uses eval to run modules, to get around the ESM limited of being unable to reload modules. This has a harmful effect on error reporting when code hits errors. I have some plans to work on error reporting, or work to get changes made to the ESM spec, but at current time error reporting isn't great.
200
+ 0: success
201
+ 3: some test errors
202
+ 2: other error
203
+ It may also crash due to exceptions without giving any of these errors codes