@lvce-editor/test-with-playwright 4.1.0 → 5.0.1
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 +4 -6
- package/src/parts/GetTestWorkerPath/GetTestWorkerPath.js +4 -2
- package/src/parts/HandleCliArgs/HandleCliArgs.js +7 -2
- package/src/parts/Main/Main.js +2 -4
- package/src/parts/RunAllTests/RunAllTests.js +9 -14
- package/src/parts/Command/Command.js +0 -1
- package/src/parts/HandleIpc/HandleIpc.js +0 -5
- package/src/parts/HandleMessage/HandleMessage.js +0 -26
- package/src/parts/IpcParent/IpcParent.js +0 -9
- package/src/parts/IpcParentModule/IpcParentModule.js +0 -11
- package/src/parts/IpcParentType/IpcParentType.js +0 -2
- package/src/parts/JsonRpc/JsonRpc.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/test-with-playwright",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,16 +10,14 @@
|
|
|
10
10
|
"url": "git@github.com:lvce-editor/test-with-playwright.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [],
|
|
13
|
-
"author": "",
|
|
13
|
+
"author": "Lvce Editor",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@lvce-editor/assert": "^1.4.0",
|
|
17
|
-
"@lvce-editor/
|
|
18
|
-
"@lvce-editor/ipc": "^14.5.0",
|
|
19
|
-
"@lvce-editor/json-rpc": "^7.0.0",
|
|
17
|
+
"@lvce-editor/rpc": "^4.18.0",
|
|
20
18
|
"@lvce-editor/verror": "^1.7.0",
|
|
21
19
|
"minimist": "^1.2.8",
|
|
22
|
-
"@lvce-editor/test-with-playwright-worker": "
|
|
20
|
+
"@lvce-editor/test-with-playwright-worker": "5.0.1",
|
|
23
21
|
"@lvce-editor/test-worker": "^5.4.0"
|
|
24
22
|
},
|
|
25
23
|
"devDependencies": {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
2
|
|
|
3
3
|
export const getTestWorkerPath = () => {
|
|
4
|
-
|
|
4
|
+
const url = import.meta.resolve('@lvce-editor/test-with-playwright-worker')
|
|
5
|
+
const path = fileURLToPath(url)
|
|
6
|
+
return path
|
|
5
7
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import * as GetOptions from '../GetOptions/GetOptions.js'
|
|
2
2
|
import * as RunAllTests from '../RunAllTests/RunAllTests.js'
|
|
3
|
+
import * as GetTestWorkerPath from '../GetTestWorkerPath/GetTestWorkerPath.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
6
|
-
* @param {{argv:string[], env:any}} param0
|
|
7
|
+
* @param {{argv:string[], env:any, commandMap:any}} param0
|
|
7
8
|
*/
|
|
8
|
-
export const handleCliArgs = async ({ argv, env }) => {
|
|
9
|
+
export const handleCliArgs = async ({ argv, env, commandMap }) => {
|
|
9
10
|
const cwd = process.cwd()
|
|
10
11
|
const options = GetOptions.getOptions({ argv, env })
|
|
11
12
|
const onlyExtension = options.onlyExtension
|
|
12
13
|
const testPath = options.testPath
|
|
13
14
|
const headless = options.headless
|
|
14
15
|
const timeout = 30_000
|
|
16
|
+
const testWorkerPath = GetTestWorkerPath.getTestWorkerPath()
|
|
17
|
+
|
|
15
18
|
// TODO
|
|
16
19
|
// console.log({ argv, env })
|
|
17
20
|
await RunAllTests.runAllTests({
|
|
@@ -20,5 +23,7 @@ export const handleCliArgs = async ({ argv, env }) => {
|
|
|
20
23
|
cwd,
|
|
21
24
|
headless,
|
|
22
25
|
timeout,
|
|
26
|
+
commandMap,
|
|
27
|
+
testWorkerPath,
|
|
23
28
|
})
|
|
24
29
|
}
|
package/src/parts/Main/Main.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as Command from '../Command/Command.js'
|
|
2
1
|
import * as CommandMap from '../CommandMap/CommandMap.js'
|
|
3
2
|
import * as HandleCliArgs from '../HandleCliArgs/HandleCliArgs.js'
|
|
4
3
|
import * as Process from '../Process/Process.js'
|
|
5
4
|
import * as ProcessListeners from '../ProcessListeners/ProcessListeners.js'
|
|
6
5
|
|
|
7
|
-
export const main = () => {
|
|
6
|
+
export const main = async () => {
|
|
8
7
|
Process.on('uncaughtExceptionMonitor', ProcessListeners.handleUncaughtExceptionMonitor)
|
|
9
|
-
|
|
10
|
-
HandleCliArgs.handleCliArgs({ argv: Process.argv, env: Process.env })
|
|
8
|
+
await HandleCliArgs.handleCliArgs({ argv: Process.argv, env: Process.env, commandMap: CommandMap.commandMap })
|
|
11
9
|
}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as HandleIpc from '../HandleIpc/HandleIpc.js'
|
|
3
|
-
import * as IpcParent from '../IpcParent/IpcParent.js'
|
|
4
|
-
import * as IpcParentType from '../IpcParentType/IpcParentType.js'
|
|
5
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js'
|
|
1
|
+
import { NodeWorkerRpcParent } from '@lvce-editor/rpc'
|
|
6
2
|
import * as TestWorkerCommandType from '../TestWorkerCommandType/TestWorkerCommandType.js'
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
*
|
|
10
|
-
* @param {{onlyExtension:string, testPath:string, cwd:string, headless:boolean, timeout:number}} param0
|
|
6
|
+
* @param {{onlyExtension:string, testPath:string, cwd:string, headless:boolean, timeout:number, commandMap:any, testWorkerPath:string}} param0
|
|
11
7
|
*/
|
|
12
|
-
export const runAllTests = async ({ onlyExtension, testPath, cwd, headless, timeout }) => {
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
path,
|
|
8
|
+
export const runAllTests = async ({ onlyExtension, testPath, cwd, headless, timeout, commandMap, testWorkerPath }) => {
|
|
9
|
+
// TODO use `using` once supported
|
|
10
|
+
const rpc = await NodeWorkerRpcParent.create({
|
|
11
|
+
path: testWorkerPath,
|
|
17
12
|
argv: [],
|
|
13
|
+
commandMap,
|
|
18
14
|
})
|
|
19
|
-
|
|
20
|
-
await
|
|
21
|
-
ipc.dispose()
|
|
15
|
+
await rpc.invoke(TestWorkerCommandType.RunAllTests, onlyExtension, testPath, cwd, headless, timeout)
|
|
16
|
+
await rpc.dispose()
|
|
22
17
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@lvce-editor/command'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as Command from '../Command/Command.js'
|
|
2
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js'
|
|
3
|
-
|
|
4
|
-
const prepare = (error) => {
|
|
5
|
-
return error
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const requiresSocket = (method) => {
|
|
9
|
-
return false
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const logError = (error) => {
|
|
13
|
-
console.error(error)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const handleMessage = (event) => {
|
|
17
|
-
return JsonRpc.handleJsonRpcMessage(
|
|
18
|
-
event.target,
|
|
19
|
-
event.data,
|
|
20
|
-
Command.execute,
|
|
21
|
-
JsonRpc.resolve,
|
|
22
|
-
prepare,
|
|
23
|
-
logError,
|
|
24
|
-
requiresSocket,
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as IpcParentModule from '../IpcParentModule/IpcParentModule.js'
|
|
2
|
-
|
|
3
|
-
export const create = async ({ method, ...options }) => {
|
|
4
|
-
const module = IpcParentModule.getModule(method)
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
const rawIpc = await module.create(options)
|
|
7
|
-
const ipc = module.wrap(rawIpc)
|
|
8
|
-
return ipc
|
|
9
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as IpcParentType from '../IpcParentType/IpcParentType.js'
|
|
2
|
-
import { IpcParentWithNodeWorker } from '@lvce-editor/ipc'
|
|
3
|
-
|
|
4
|
-
export const getModule = (method) => {
|
|
5
|
-
switch (method) {
|
|
6
|
-
case IpcParentType.NodeWorker:
|
|
7
|
-
return IpcParentWithNodeWorker
|
|
8
|
-
default:
|
|
9
|
-
throw new Error('unexpected ipc type')
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@lvce-editor/json-rpc'
|