@lvce-editor/test-with-playwright 0.0.17 → 0.0.20

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/all.js +11 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright",
3
- "version": "0.0.17",
3
+ "version": "0.0.20",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "types": "src/main.d.ts",
@@ -14,7 +14,7 @@
14
14
  "author": "",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@playwright/test": "^1.25.0",
17
+ "@playwright/test": "^1.25.1",
18
18
  "get-port": "^6.1.2",
19
19
  "minimist": "^1.2.6",
20
20
  "read-pkg-up": "^9.1.0"
package/src/all.js CHANGED
@@ -5,11 +5,20 @@ import { performance } from 'node:perf_hooks'
5
5
  import { closeAll, getRoot, runTest, startAll, state } from './main.js'
6
6
  import parseArgv from 'minimist'
7
7
 
8
+ /**
9
+ * @param {string} name
10
+ */
11
+ const isTestFile = (name) => {
12
+ return !name.startsWith('_')
13
+ }
14
+
8
15
  /**
9
16
  * @param {string} root
10
17
  */
11
18
  const getTestFiles = async (root) => {
12
- return readdirSync(root).map((x) => join(root, x))
19
+ return readdirSync(root)
20
+ .filter(isTestFile)
21
+ .map((x) => join(root, x))
13
22
  }
14
23
 
15
24
  /**
@@ -18,7 +27,7 @@ const getTestFiles = async (root) => {
18
27
  */
19
28
  const getUrlFromTestFile = (absolutePath, port) => {
20
29
  const baseName = basename(absolutePath)
21
- const htmlFileName = baseName.replace('.js', '.html')
30
+ const htmlFileName = baseName.slice(0, -'.js'.length) + '.html'
22
31
  return `http://localhost:${port}/tests/${htmlFileName}`
23
32
  }
24
33