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

Commit12c72c2

Browse files
committed
cleanup test return response
1 parenta9730d0 commit12c72c2

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

‎src/test/runTest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ async function main() {
2121
// Download VS Code, unzip it and run the integration test
2222
awaitrunTests(config)
2323
.catch((err:Error)=>{
24-
console.error('Failed to run tests')
2524
console.error(err)
2625
process.exit(1)
2726
})
27+
28+
process.exit(0)
2829
}
2930

3031
main()

‎src/test/suite/extension.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
// import * as vscode from 'vscode'
55
// import * as myExtension from '../../extension'
66

7-
console.log('running extension.test.js')
8-
97
describe('Extension tests',()=>{
108
test('Some test',()=>{
11-
console.log('some test ran!')
129
expect(2).toBe(2)
1310
})
1411
})

‎src/test/suite/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,24 @@ export async function run(): Promise<void> {
88

99
constconfig={
1010
bail:false,
11-
//rootDir: testDir,
11+
rootDir:testDir,
1212
browser:false,
1313
json:false,
1414
useStderr:true,
1515
}
1616
//@ts-ignore
17-
constresult=awaitjest.runCLI(config,[testDir])
17+
const{results}=awaitjest.runCLI(config,[testDir])
1818
.catch((failure:any)=>{
1919
console.error(failure)
2020
})
2121

22-
console.log('--- JEST OUTPUT ---\n\n',JSON.stringify(result.results,null,2))
22+
if(results.numFailedTests>0){
23+
constfailedTests=results.testResults.filter((t:any)=>t.numFailingTests||t.numPendingTests)
24+
25+
failedTests.forEach(console.log)
26+
thrownewError(' Test(s) failed')
27+
}
28+
29+
console.log('--- JEST OUTPUT ---\n\n',JSON.stringify(results,null,2))
30+
console.log(`${results.numPassedTests} test(s) passed!`)
2331
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp