File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 4040 "execa" : " 0.8.0" ,
4141 "jest" : " 23.0.1" ,
4242 "prettier" : " 1.13.0"
43+ },
44+ "prettier" : {
45+ "singleQuote" : true ,
46+ "trailingComma" : " all"
4347 }
4448}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class JestPluginProjects {
1313 apply ( jestHook ) {
1414 jestHook . onFileChange ( ( { projects } ) => this . _setProjects ( projects ) ) ;
1515 jestHook . shouldRunTestSuite ( ( { testPath, config } ) => {
16- const name = config . displayName || path . basename ( config . rootDir ) ;
16+ const name = this . _getDisplayName ( config ) || this . _getBasename ( config ) ;
1717 return (
1818 this . _activeProjects [ name ] === undefined || this . _activeProjects [ name ]
1919 ) ;
@@ -22,10 +22,22 @@ class JestPluginProjects {
2222
2323 onKey ( ) { }
2424
25+ _getDisplayName ( config ) {
26+ const { displayName } = config ;
27+ return typeof displayName === 'object' ? displayName . name : displayName ;
28+ }
29+
30+ _getBasename ( config ) {
31+ const { rootDir } = config ;
32+ return path . basename ( rootDir ) ;
33+ }
34+
2535 _setProjects ( projects ) {
2636 if ( ! this . _projectNames . length ) {
2737 const projectNameSet = projects . reduce ( ( state , p ) => {
28- const { displayName, rootDir } = p . config ;
38+ const displayName = this . _getDisplayName ( p . config ) ;
39+ const basename = this . _getBasename ( p . config ) ;
40+
2941 if ( state . has ( displayName ) ) {
3042 throw new Error ( `
3143
@@ -37,7 +49,6 @@ Change the \`displayName\` on at least one of them to prevent name collision.
3749 ` ) ;
3850 }
3951
40- const basename = path . basename ( rootDir ) ;
4152 if ( state . has ( basename ) ) {
4253 throw new Error ( `
4354
You can’t perform that action at this time.
0 commit comments