@yamf/test 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamf/test",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Functional testing module - with polymorphic async/await and simultaneous assertion reports",
6
6
  "main": "src/index.js",
@@ -31,9 +31,9 @@
31
31
  "url": "https://github.com/mcbrumagin/yamf"
32
32
  },
33
33
  "peerDependencies": {
34
- "@yamf/core": "^0.3.1"
34
+ "@yamf/core": "0.4.0"
35
35
  },
36
36
  "scripts": {
37
- "test": "./tests/test.sh"
37
+ "test": "yamf test -d ."
38
38
  }
39
39
  }
@@ -13,7 +13,7 @@ const getTargetString = (val, pad) => {
13
13
  } else if (typeof val === 'object') {
14
14
  return JSON.stringify(val)
15
15
  } else {
16
- return val.toString()
16
+ return val?.toString()
17
17
  }
18
18
  }
19
19
 
@@ -38,7 +38,7 @@ export class AssertionFailureDetail {
38
38
  childMessages = childMessages || ''
39
39
  return `${pad}for target (${type}) value = ${val}`
40
40
  + this.assertFns.map(fn =>
41
- `\n${pad}failed -> ${fn?.name || fn.toString().replace(/^\s?.+\=\>\s?/, '')}`
41
+ `\n${pad}failed -> ${fn?.name || fn.toString().replace(/^\s?.+?\=\>\s?/, '')}`
42
42
  ).join('')
43
43
  + childMessages
44
44
  }
package/src/cli.js CHANGED
@@ -1,49 +1,7 @@
1
-
2
- /* TODO add cli options and flags
3
-
4
- --name <name> (matching text or wildcard)
5
- --file <file> (matching file name text or wildcard; is a test suite by default)
6
-
7
-
8
- ---TODO determine features and flags from the following suggested list---
9
-
10
- Essential test CLI options and flags vary significantly depending on the specific testing framework or tool being used. However, common categories of options and flags found across many testing CLIs include:
11
- Execution Control:
12
-
13
- Running specific tests:
14
- --test-name <name> or similar: Executes a single test or a group of tests matching a pattern.
15
- --grep <pattern>: Filters tests based on a regular expression pattern in their names.
16
- --file <path>: Runs tests only from specified files.
17
- Controlling execution flow:
18
- --fail-fast or --first: Stops test execution immediately upon the first failure.
19
- --bail: Similar to fail-fast, often with more granular control over how many failures are tolerated before stopping.
20
- --retries <n>: Reruns failed tests a specified number of times.
21
-
22
- Output and Reporting:
23
-
24
- Verbosity levels:
25
- --verbose or -v: Provides more detailed output during test execution.
26
- --quiet or -q: Suppresses most output, showing only essential information like summaries.
27
- Reporting formats:
28
- --reporter <format>: Specifies the output format for test results (e.g., json, junit, html).
29
- --output <file>: Redirects test output to a specified file.
30
- Code coverage:
31
- --coverage: Enables code coverage analysis and reporting.
32
- --coverage-report <format>: Specifies the format for coverage reports.
33
-
34
- Configuration and Setup:
35
-
36
- Configuration files:
37
- --config <file>: Specifies an alternative configuration file for the test runner.
38
- Environment variables:
39
- --env <key=value>: Sets environment variables for the test process.
40
- Setup/Teardown scripts:
41
- --pre-flight <script>: Runs a script or command before any tests execute.
42
- --post-flight <script>: Runs a script or command after all tests have completed.
43
-
44
- Debugging and Development:
45
-
46
- Debugging tools:
47
- --inspect or --debug: Enables debugging features, often allowing attachment of a debugger.
48
- --watch: Reruns tests automatically when relevant files change.
49
- */
1
+ /**
2
+ * The yamf CLI has moved to @yamf/cli.
3
+ *
4
+ * Run tests with: yamf test
5
+ *
6
+ * Install: pnpm add -D @yamf/cli
7
+ */
package/src/runner.js CHANGED
@@ -196,13 +196,13 @@ function reportTestResults({
196
196
  } else logger.info(logger.writeColor('green', '✔ ✔ ✔ All Tests Passed! ✔ ✔ ✔'))
197
197
 
198
198
  logger.info('\n----- Test Overview -----')
199
- logger.info(`ℹ tests ${testSuccess + testFail}`)
200
- if (testSuitesCount > 0) logger.info(`ℹ suites ${testSuitesCount}`)
201
- logger.info(`ℹ pass ${testSuccess}`)
202
- logger.info(`ℹ fail ${testFail}`)
203
- logger.info(`ℹ skipped ${skippedCases.length}`)
204
- logger.info(`ℹ todo ${todoCases.length}`)
205
- logger.info(`ℹ duration_ms ${durationMs}`)
199
+ logger.info(`ℹ tests ${testSuccess + testFail} `)
200
+ if (testSuitesCount > 0) logger.info(`ℹ suites ${testSuitesCount} `)
201
+ logger.info(`ℹ pass ${testFail === 0 ? logger.writeColor('green', testSuccess) : testSuccess} `)
202
+ logger.info(`ℹ fail ${testFail > 0 ? logger.writeColor('red', testFail) : testFail} `)
203
+ logger.info(`ℹ skipped ${skippedCases.length} `)
204
+ logger.info(`ℹ todo ${todoCases.length} `)
205
+ logger.info(`ℹ duration_ms ${durationMs} `)
206
206
  logger.info('')
207
207
 
208
208
  if (isSoloRun) logger.warn(logger.writeColor('magenta', 'This was a solo test run, remove "solo" flags for a full test run'))