File tree 4 files changed +16
-5
lines changed
built-in-plugins/command-test/plugin
4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export const runTest = async (options: IOpts) => {
41
41
) ,
42
42
} ;
43
43
44
- await jest . runCLI (
44
+ const result = await jest . runCLI (
45
45
{
46
46
_ : options . _ ,
47
47
$0 : options . $0 ,
@@ -50,9 +50,11 @@ export const runTest = async (options: IOpts) => {
50
50
[ pri . projectRootPath ] ,
51
51
) ;
52
52
53
- logText (
54
- `Open this url to see code coverage: file://${ path . join ( pri . projectRootPath , 'coverage/lcov-report/index.html' ) } ` ,
55
- ) ;
53
+ plugin . afterTestRunCallbacks . forEach ( callback => {
54
+ return callback ( result ) ;
55
+ } ) ;
56
+
57
+ logText ( `Open this url to see code coverage: file://${ path . join ( pri . sourceRoot , 'coverage/lcov-report/index.html' ) } ` ) ;
56
58
57
59
process . exit ( 0 ) ;
58
60
} ;
Original file line number Diff line number Diff line change 1
1
import { plugin } from '../utils/plugins' ;
2
- import { IJestConfigPipe } from '../utils/define' ;
2
+ import { IJestConfigPipe , IAfterTestRun } from '../utils/define' ;
3
3
4
4
export const pipeJestConfig = ( pipe : IJestConfigPipe ) => {
5
5
plugin . jestConfigPipes . push ( pipe ) ;
6
6
} ;
7
+
8
+ export const afterTestRun = ( callback : IAfterTestRun ) => {
9
+ plugin . afterTestRunCallbacks . push ( callback ) ;
10
+ } ;
Original file line number Diff line number Diff line change @@ -394,3 +394,5 @@ export interface IPluginModule {
394
394
export type IDevDllList = ( list : string [ ] ) => string [ ] ;
395
395
396
396
export type IJestConfigPipe = ( options : any ) => any ;
397
+
398
+ export type IAfterTestRun = ( result ?: any ) => any ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
21
21
ProjectType ,
22
22
IDevDllList ,
23
23
IJestConfigPipe ,
24
+ IAfterTestRun ,
24
25
} from './define' ;
25
26
import { getBabelOptions } from './babel-options' ;
26
27
import { tempPath , srcPath } from '../node' ;
@@ -95,6 +96,8 @@ export class IPluginConfig {
95
96
96
97
public jestConfigPipes : IJestConfigPipe [ ] = [ ] ;
97
98
99
+ public afterTestRunCallbacks : IAfterTestRun [ ] = [ ] ;
100
+
98
101
// Lock init type
99
102
public initType : ProjectType = null ;
100
103
}
You can’t perform that action at this time.
0 commit comments