Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea29d23

Browse files
committed
create basic tap-parser
1 parent9b9ed40 commitea29d23

File tree

5 files changed

+15
-73
lines changed

5 files changed

+15
-73
lines changed

‎package-lock.json

Lines changed: 0 additions & 57 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"watch":"tsc -watch -p ./"
3131
},
3232
"dependencies": {
33-
"jsdom":"^15.2.1",
34-
"tap-parser":"^10.0.1"
33+
"jsdom":"^15.2.1"
3534
},
3635
"devDependencies": {
3736
"@types/assert":"^1.4.3",

‎src/editor/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export const createCommands = ({extensionPath, workspaceState, workspaceRoot}: C
8080
currentStepId=stepId
8181
},
8282
[COMMANDS.RUN_TEST]:(current:Payload|undefined,onSuccess:()=>void)=>{
83-
console.log('-------- command.run_test ------ ')
8483
// use stepId from client, or last set stepId
8584
constpayload:Payload={stepId:current ?current.stepId :currentStepId}
8685
testRunner(payload,onSuccess)

‎src/services/testRunner/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => {
2525
returnasync(payload:Payload,onSuccess?:()=>void):Promise<void>=>{
2626
console.log('------------------- run test ------------------')
2727

28-
// track processId to prevent multiple
29-
constprocessId=setLatestProcess()
30-
if(!isLatestProcess(processId)){return}
31-
3228
// flag as running
3329
callbacks.onRun(payload)
3430

@@ -41,7 +37,7 @@ const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => {
4137
const{stdout, stderr}=result
4238

4339
// simple way to throttle requests
44-
if(!stdout||!isLatestProcess(processId)){return}
40+
if(!stdout){return}
4541

4642
if(stderr){
4743
callbacks.onError(payload)
@@ -54,8 +50,8 @@ const createTestRunner = (config: TestRunnerConfig, callbacks: Callbacks) => {
5450
}
5551

5652
// pass or fail?
57-
const{ok}=parser(stdout)
58-
if(ok){
53+
consttap=parser(stdout)
54+
if(tap.ok){
5955
callbacks.onSuccess(payload)
6056
if(onSuccess){onSuccess()}
6157
}else{

‎src/services/testRunner/parser.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
constTapParser=require('tap-parser')
2-
3-
// https://github.com/tapjs/tap-parser#var-p--new-parseroptions-cb
4-
constoptions={
5-
bail:true,
1+
interfaceParserOutput{
2+
ok:boolean
63
}
74

8-
constparser=newTapParser(options)
5+
constparser=(text:string):ParserOutput=>{
6+
constlines=text.split('\n')
7+
for(constlineoflines){
8+
if(line.match(/^notok/)){
9+
return{ok:false}
10+
}
11+
}
12+
return{ok:true}
13+
}
914

1015
exportdefaultparser

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp