Fixing issue with unit tests so that they run properly on Darwin/Windows
This commit is contained in:
parent
149612cd65
commit
2f3b8c00e9
|
@ -13,7 +13,6 @@ addons:
|
||||||
before_install:
|
before_install:
|
||||||
- go get github.com/mattn/goveralls
|
- go get github.com/mattn/goveralls
|
||||||
script:
|
script:
|
||||||
- export PATH=$PATH:$HOME/hs
|
|
||||||
- export CHROMEDP_TEST_RUNNER=google-chrome-stable
|
- export CHROMEDP_TEST_RUNNER=google-chrome-stable
|
||||||
- export CHROMEDP_DISABLE_GPU=true
|
- export CHROMEDP_DISABLE_GPU=true
|
||||||
- go test -v -coverprofile=coverage.out
|
- go test -v -coverprofile=coverage.out
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -72,9 +73,19 @@ func TestMain(m *testing.M) {
|
||||||
|
|
||||||
// its worth noting that newer versions of chrome (64+) run much faster
|
// its worth noting that newer versions of chrome (64+) run much faster
|
||||||
// than older ones -- same for headless_shell ...
|
// than older ones -- same for headless_shell ...
|
||||||
|
execPath := runner.DefaultChromePath
|
||||||
if testRunner := os.Getenv("CHROMEDP_TEST_RUNNER"); testRunner != "" {
|
if testRunner := os.Getenv("CHROMEDP_TEST_RUNNER"); testRunner != "" {
|
||||||
cliOpts = append(cliOpts, runner.ExecPath(testRunner))
|
execPath = testRunner
|
||||||
|
} else {
|
||||||
|
// use headless_shell, if on path
|
||||||
|
var hsPath string
|
||||||
|
hsPath, err = exec.LookPath("headless_shell")
|
||||||
|
if err == nil {
|
||||||
|
execPath = hsPath
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
cliOpts = append(cliOpts, runner.ExecPath(execPath))
|
||||||
|
|
||||||
// not explicitly needed to be set, as this vastly speeds up unit tests
|
// not explicitly needed to be set, as this vastly speeds up unit tests
|
||||||
if noSandbox := os.Getenv("CHROMEDP_NO_SANDBOX"); noSandbox != "false" {
|
if noSandbox := os.Getenv("CHROMEDP_NO_SANDBOX"); noSandbox != "false" {
|
||||||
cliOpts = append(cliOpts, runner.NoSandbox)
|
cliOpts = append(cliOpts, runner.NoSandbox)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user