@lvce-editor/test-with-playwright-worker 2.0.0 → 2.1.0
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,10 @@
|
|
|
1
|
-
import { join } from 'path'
|
|
1
|
+
import { join } from 'node:path'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
2
3
|
|
|
3
4
|
export const getServerPath = async () => {
|
|
4
5
|
const toTry = [
|
|
5
6
|
'@lvce-editor/server',
|
|
6
|
-
join(process.cwd(), '..', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js'),
|
|
7
|
+
pathToFileURL(join(process.cwd(), '..', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(),
|
|
7
8
|
]
|
|
8
9
|
|
|
9
10
|
for (const path of toTry) {
|
|
@@ -4,13 +4,19 @@ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
|
|
|
4
4
|
import * as IsTestFile from '../IsTestFile/IsTestFile.js'
|
|
5
5
|
import { NoTestFilesFoundError } from '../NoTestFilesFoundError/NoTestFilesFoundError.js'
|
|
6
6
|
|
|
7
|
+
const getName = (dirent) => {
|
|
8
|
+
return dirent.name
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* @param {string} testSrc
|
|
9
13
|
*/
|
|
10
14
|
export const getTests = async (testSrc) => {
|
|
11
15
|
try {
|
|
12
|
-
const dirents = await readdir(testSrc
|
|
13
|
-
|
|
16
|
+
const dirents = await readdir(testSrc, {
|
|
17
|
+
withFileTypes: true,
|
|
18
|
+
})
|
|
19
|
+
return dirents.filter(IsTestFile.isTestFile).map(getName)
|
|
14
20
|
} catch (error) {
|
|
15
21
|
if (IsEnoentError.isEnoentError(error)) {
|
|
16
22
|
throw new NoTestFilesFoundError(testSrc)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Dirent } from 'node:fs'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
* @param {
|
|
4
|
+
* @param {Dirent} dirent
|
|
3
5
|
*/
|
|
4
|
-
export const isTestFile = (
|
|
5
|
-
return !name.startsWith('_')
|
|
6
|
+
export const isTestFile = (dirent) => {
|
|
7
|
+
return dirent.isFile() && !dirent.name.startsWith('_')
|
|
6
8
|
}
|