MCPcopy
hub / github.com/mxschmitt/playwright-go / TestNpmRegistryEnv

Function TestNpmRegistryEnv

run_test.go:111–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestNpmRegistryEnv(t *testing.T) {
112 driverPath := t.TempDir()
113 driver, err := NewDriver(&RunOptions{
114 DriverDirectory: driverPath,
115 SkipInstallBrowsers: true,
116 })
117 if err != nil {
118 t.Fatalf("could not start driver: %v", err)
119 }
120 uri := ""
121 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
122 uri = r.URL.String()
123 w.WriteHeader(404)
124 }))
125 defer ts.Close()
126
127 t.Setenv("PLAYWRIGHT_GO_NPM_REGISTRY", ts.URL)
128 err = driver.Install()
129 if err == nil || !strings.Contains(err.Error(), "404 Not Found") || !strings.Contains(uri, "playwright-core") {
130 t.Fatalf("PLAYWRIGHT_GO_NPM_REGISTRY does not work: %v", err)
131 }
132}
133
134func TestNodePlatformSuffix(t *testing.T) {
135 suffix, err := nodePlatformSuffix()

Callers

nothing calls this directly

Calls 5

NewDriverFunction · 0.85
StringMethod · 0.65
CloseMethod · 0.65
InstallMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected