@@ -187,10 +187,52 @@ describe('Given a config with two named projects, first-project and second-proje
187187 it ( 'fails' , ( ) => {
188188 expect ( result ) . toHaveProperty ( 'failed' , true ) ;
189189 } ) ;
190- // FIXME(F3n67u)
191190 it . skip ( 'prints that no project was found' , ( ) => {
192191 expect ( result . stdout ) . toMatch (
193- / ^ Y o u p r o v i d e d v a l u e s f o r - - s e l e c t P r o j e c t s b u t n o p r o j e c t s w e r e f o u n d m a t c h i n g t h e s e l e c t i o n / ,
192+ / ^ Y o u p r o v i d e d v a l u e s f o r - - i g n o r e P r o j e c t s , b u t n o p r o j e c t s w e r e f o u n d m a t c h i n g t h e s e l e c t i o n / ,
193+ ) ;
194+ } ) ;
195+ } ) ;
196+
197+ describe ( 'when Jest is started with `--selectProjects first-project second-project --ignoreProjects first-project` ' , ( ) => {
198+ let result : RunJestJsonResult ;
199+ beforeAll ( ( ) => {
200+ result = runWithJson ( 'select-projects' , [
201+ '--selectProjects' ,
202+ 'first-project' ,
203+ 'second-project' ,
204+ '--ignoreProjects' ,
205+ 'first-project' ,
206+ ] ) ;
207+ } ) ;
208+ it ( 'runs the tests in the second project only' , ( ) => {
209+ expect ( result . json ) . toHaveProperty ( 'success' , true ) ;
210+ expect ( result . json ) . toHaveProperty ( 'numTotalTests' , 1 ) ;
211+ expect ( result . json . testResults . map ( ( { name} ) => name ) ) . toEqual ( [
212+ resolve ( dir , '__tests__/second-project.test.js' ) ,
213+ ] ) ;
214+ } ) ;
215+ it ( 'prints that only second-project will run' , ( ) => {
216+ expect ( result . stderr ) . toMatch ( / ^ R u n n i n g o n e p r o j e c t : s e c o n d - p r o j e c t / ) ;
217+ } ) ;
218+ } ) ;
219+
220+ describe ( 'when Jest is started with `--selectProjects first-project --ignoreProjects first-project` ' , ( ) => {
221+ let result : RunJestResult ;
222+ beforeAll ( ( ) => {
223+ result = run ( 'select-projects' , [
224+ '--selectProjects' ,
225+ 'first-project' ,
226+ '--ignoreProjects' ,
227+ 'first-project' ,
228+ ] ) ;
229+ } ) ;
230+ it ( 'fails' , ( ) => {
231+ expect ( result ) . toHaveProperty ( 'failed' , true ) ;
232+ } ) ;
233+ it . skip ( 'prints that no project was found' , ( ) => {
234+ expect ( result . stdout ) . toMatch (
235+ / ^ Y o u p r o v i d e d v a l u e s f o r - - s e l e c t P r o j e c t s a n d - - i g n o r e P r o j e c t s , b u t n o p r o j e c t s w e r e f o u n d m a t c h i n g t h e s e l e c t i o n ./ ,
194236 ) ;
195237 } ) ;
196238 } ) ;
0 commit comments