wjdp / htmltest

:white_check_mark: Test generated HTML for problems
MIT License
325 stars 54 forks source link

cannot put StripQueryExcludes into config file #143

Closed slawo-ch closed 3 years ago

slawo-ch commented 4 years ago

Describe the bug

Create a file .htmltest.yml containing

StripQueryExcludes: [
  "https://marketplace.visualstudio.com"
]

Running htmltest it seems that it fails to understand the file:

$ htmltest 
htmltest started at 01:20:19 on <nil>
========================================================================
panic: reflect.Set: value of type []interface {} is not assignable to type []string

goroutine 1 [running]:
reflect.Value.assignTo(0x131b960, 0xc00000d620, 0x97, 0x139ef83, 0xb, 0x131cce0, 0x0, 0x135c6c0, 0xccf1d99aede24742, 0x17)
        /home/travis/.gimme/versions/go1.13.6.linux.amd64/src/reflect/value.go:2403 +0x432
reflect.Value.Set(0x131cce0, 0xc0000d27a0, 0x197, 0x131b960, 0xc00000d620, 0x97)
        /home/travis/.gimme/versions/go1.13.6.linux.amd64/src/reflect/value.go:1537 +0xbd
github.com/imdario/mergo.deepMerge(0x131cce0, 0xc0000d27a0, 0x197, 0x131b960, 0xc00000d620, 0x97, 0xc000101720, 0x1, 0xc00000d700, 0x0, ...)
        /home/travis/gopath/pkg/mod/github.com/imdario/mergo@v0.3.8/merge.go:165 +0x26cd
github.com/imdario/mergo.deepMap(0x1398640, 0xc0000d26c0, 0x199, 0x1332560, 0xc000081a40, 0x15, 0xc000101720, 0x0, 0xc00000d700, 0x15, ...)
        /home/travis/gopath/pkg/mod/github.com/imdario/mergo@v0.3.8/map.go:102 +0x84f
github.com/imdario/mergo._map(0x1335200, 0xc0000d26c0, 0x1332560, 0xc000081a40, 0xc00000e3d8, 0x1, 0x1, 0x1, 0x0)
        /home/travis/gopath/pkg/mod/github.com/imdario/mergo@v0.3.8/map.go:174 +0x204
github.com/imdario/mergo.MapWithOverwrite(...)
        /home/travis/gopath/pkg/mod/github.com/imdario/mergo@v0.3.8/map.go:140
github.com/wjdp/htmltest/htmltest.(*HTMLTest).setOptions(0xc0000d26c0, 0xc000081980)
        /home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/options.go:150 +0x1ed
github.com/wjdp/htmltest/htmltest.Test(0xc000081980, 0xc00000e018, 0xc000101d48, 0x1)
        /home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:47 +0xae
main.run(0xc000081980, 0xc000081980)
        /home/travis/gopath/src/github.com/wjdp/htmltest/main.go:159 +0x207
main.main()
        /home/travis/gopath/src/github.com/wjdp/htmltest/main.go:66 +0x268

I tried placing just the domain name into the list, but I get the same error every time. no matter what I put into StripQueryExcludes.

Interestingly, even the empty list StripQueryExcludes: [] fails.

Versions

wjdp commented 4 years ago

This feels like yaml parsing into the wrong type and us not catching the exception.

Please try

StripQueryExcludes:
  - https://website.com
slawo-ch commented 4 years ago

Was my first guess too and one of the first things I tried, same result.

wjdp commented 3 years ago

Fixed in 3c05eff7afcbfbb408b5918ee08602b399bae9b4