velocious 1.0.63 → 1.0.64

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,9 +1,9 @@
1
1
  {
2
2
  "bin": {
3
- "velocious": "bin/velocious.js"
3
+ "velocious": "bin/velocious.mjs"
4
4
  },
5
5
  "name": "velocious",
6
- "version": "1.0.63",
6
+ "version": "1.0.64",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "test": "VELOCIOUS_TEST_DIR=../ cd spec/dummy && npx velocious test",
@@ -1,4 +1,6 @@
1
1
  import Configuration from "./configuration.js"
2
+ import envSense from "env-sense/src/use-env-sense.js"
3
+ import fileExists from "./utils/file-exists.js"
2
4
 
3
5
  const configurationResolver = async (args) => {
4
6
  if (Configuration.current(false)) {
@@ -6,8 +8,17 @@ const configurationResolver = async (args) => {
6
8
  }
7
9
 
8
10
  const directory = args.directory || process.cwd()
9
- const configurationPath = `${directory}/src/config/configuration.js`
10
- let configuration
11
+ let configurationPrePath = `${directory}/src/config/configuration`
12
+ const configurationPathForNode = `${configurationPrePath}.node.js`
13
+ const configurationPathDefault = `${configurationPrePath}.js`
14
+ const {isServer} = envSense()
15
+ let configuration, configurationPath
16
+
17
+ if (isServer && await fileExists(configurationPathForNode)) {
18
+ configurationPath = configurationPathForNode
19
+ } else {
20
+ configurationPath = configurationPathDefault
21
+ }
11
22
 
12
23
  try {
13
24
  const configurationImport = await import(configurationPath)
@@ -23,7 +23,7 @@ export default class TestFilesFinder {
23
23
  return this.foundFiles
24
24
  }
25
25
 
26
- findingPromisesLength = () => Object.keys(this.findingPromises).length
26
+ findingPromisesLength() { return Object.keys(this.findingPromises).length }
27
27
 
28
28
  async waitForFindingPromises() {
29
29
  while (this.findingPromisesLength() > 0) {
@@ -90,7 +90,7 @@ export default class TestFilesFinder {
90
90
  return true
91
91
  }
92
92
  }
93
- } else if (file.match(/-(spec|test)\.js/)) {
93
+ } else if (file.match(/-(spec|test)\.(m|)js$/)) {
94
94
  return true
95
95
  }
96
96
 
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs/promises"
2
2
 
3
- const fileExists = async (path) => {
3
+ async function fileExists(path) {
4
4
  try {
5
5
  await fs.access(path)
6
6
 
File without changes