velocious 1.0.90 → 1.0.91

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
@@ -3,7 +3,7 @@
3
3
  "velocious": "bin/velocious.js"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.90",
6
+ "version": "1.0.91",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "lint": "eslint",
@@ -1,33 +1,7 @@
1
1
  import BaseCommand from "../base-command.js"
2
- import TestFilesFinder from "../../testing/test-files-finder.js"
3
- import TestRunner from "../../testing/test-runner.js"
4
2
 
5
3
  export default class VelociousCliCommandsTest extends BaseCommand {
6
4
  async execute() {
7
- this.getConfiguration().setEnvironment("test")
8
-
9
- const directory = process.env.VELOCIOUS_TEST_DIR || this.directory()
10
- const testFilesFinder = new TestFilesFinder({directory, processArgs: this.processArgs})
11
- const testFiles = await testFilesFinder.findTestFiles()
12
- const testRunner = new TestRunner({configuration: this.getConfiguration(), testFiles})
13
-
14
- await testRunner.prepare()
15
-
16
- if (testRunner.getTestsCount() === 0) {
17
- throw new Error("No tests has been found")
18
- }
19
-
20
- await testRunner.run()
21
-
22
- if (testRunner.isFailed()) {
23
- console.error(`\nTest run failed with ${testRunner.getFailedTests()} failed tests and ${testRunner.getSuccessfulTests()} successfull`)
24
- process.exit(1)
25
- } else if (testRunner.areAnyTestsFocussed()) {
26
- console.error(`\nFocussed run with ${testRunner.getFailedTests()} failed tests and ${testRunner.getSuccessfulTests()} successfull`)
27
- process.exit(1)
28
- } else {
29
- console.log(`\nTest run succeeded with ${testRunner.getSuccessfulTests()} successful tests`)
30
- process.exit(0)
31
- }
5
+ return await this.getConfiguration().getEnvironmentHandler().cliCommandsTest(this)
32
6
  }
33
7
  }
@@ -31,6 +31,10 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
31
31
  throw new Error("Unsupported on browser")
32
32
  }
33
33
 
34
+ async cliCommandsTest(_command) { // eslint-disable-line no-unused-vars
35
+ throw new Error("Unsupported on browser")
36
+ }
37
+
34
38
  /**
35
39
  * @returns {object}
36
40
  */
@@ -0,0 +1,33 @@
1
+ import BaseCommand from "../../../../cli/base-command.js"
2
+ import TestFilesFinder from "../../../../testing/test-files-finder.js"
3
+ import TestRunner from "../../../../testing/test-runner.js"
4
+
5
+ export default class VelociousCliCommandsTest extends BaseCommand {
6
+ async execute() {
7
+ this.getConfiguration().setEnvironment("test")
8
+
9
+ const directory = process.env.VELOCIOUS_TEST_DIR || this.directory()
10
+ const testFilesFinder = new TestFilesFinder({directory, processArgs: this.processArgs})
11
+ const testFiles = await testFilesFinder.findTestFiles()
12
+ const testRunner = new TestRunner({configuration: this.getConfiguration(), testFiles})
13
+
14
+ await testRunner.prepare()
15
+
16
+ if (testRunner.getTestsCount() === 0) {
17
+ throw new Error("No tests has been found")
18
+ }
19
+
20
+ await testRunner.run()
21
+
22
+ if (testRunner.isFailed()) {
23
+ console.error(`\nTest run failed with ${testRunner.getFailedTests()} failed tests and ${testRunner.getSuccessfulTests()} successfull`)
24
+ process.exit(1)
25
+ } else if (testRunner.areAnyTestsFocussed()) {
26
+ console.error(`\nFocussed run with ${testRunner.getFailedTests()} failed tests and ${testRunner.getSuccessfulTests()} successfull`)
27
+ process.exit(1)
28
+ } else {
29
+ console.log(`\nTest run succeeded with ${testRunner.getSuccessfulTests()} successful tests`)
30
+ process.exit(0)
31
+ }
32
+ }
33
+ }
@@ -3,6 +3,7 @@ import CliCommandsDestroyMigration from "./node/cli/commands/destroy/migration.j
3
3
  import CliCommandsInit from "./node/cli/commands/init.js"
4
4
  import CliCommandsGenerateMigration from "./node/cli/commands/generate/migration.js"
5
5
  import CliCommandsGenerateModel from "./node/cli/commands/generate/model.js"
6
+ import CliCommandsTest from "./node/cli/commands/test.js"
6
7
  import {dirname} from "path"
7
8
  import {fileURLToPath} from "url"
8
9
  import fs from "fs/promises"
@@ -62,6 +63,10 @@ export default class VelociousEnvironmentHandlerNode extends Base{
62
63
  return await this.forwardCommand(command, CliCommandsGenerateModel)
63
64
  }
64
65
 
66
+ async cliCommandsTest(command) {
67
+ return await this.forwardCommand(command, CliCommandsTest)
68
+ }
69
+
65
70
  /**
66
71
  * @param {Array<string>} commandParts
67
72
  * @template T extends import ("./base-command.js").default