closes #60 allows custom formatters to run concurrently
Этот коммит содержится в:
		
							родитель
							
								
									380fc85cb9
								
							
						
					
					
						коммит
						5a471a7e2f
					
				
					 1 изменённых файлов: 15 добавлений и 3 удалений
				
			
		
							
								
								
									
										18
									
								
								run.go
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								run.go
									
										
									
									
									
								
							| 
						 | 
					@ -13,7 +13,7 @@ type initializer func(*Suite)
 | 
				
			||||||
type runner struct {
 | 
					type runner struct {
 | 
				
			||||||
	stopOnFailure bool
 | 
						stopOnFailure bool
 | 
				
			||||||
	features      []*feature
 | 
						features      []*feature
 | 
				
			||||||
	fmt           Formatter // needs to support concurrency
 | 
						fmt           Formatter
 | 
				
			||||||
	initializer   initializer
 | 
						initializer   initializer
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,8 +97,8 @@ func RunWithOptions(suite string, contextInitializer func(suite *Suite), opt Opt
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if opt.Concurrency > 1 && opt.Format != "progress" {
 | 
						if opt.Concurrency > 1 && !supportsConcurrency(opt.Format) {
 | 
				
			||||||
		fatal(fmt.Errorf("when concurrency level is higher than 1, only progress format is supported"))
 | 
							fatal(fmt.Errorf("format \"%s\" does not support concurrent execution", opt.Format))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	formatter, err := findFmt(opt.Format)
 | 
						formatter, err := findFmt(opt.Format)
 | 
				
			||||||
	fatal(err)
 | 
						fatal(err)
 | 
				
			||||||
| 
						 | 
					@ -148,3 +148,15 @@ func Run(suite string, contextInitializer func(suite *Suite)) int {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return RunWithOptions(suite, contextInitializer, opt)
 | 
						return RunWithOptions(suite, contextInitializer, opt)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func supportsConcurrency(format string) bool {
 | 
				
			||||||
 | 
						switch format {
 | 
				
			||||||
 | 
						case "events":
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						case "junit":
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						case "pretty":
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return true // all custom formatters are treated as supporting concurrency
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче