charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
MIT License
2.23k stars 169 forks source link

Problems in running the tests. #105

Closed jpaulo-oliveira closed 3 years ago

jpaulo-oliveira commented 3 years ago

During the execution of the tests these problems are occurring:

go test -vet=off -v -p 4 github.com/charmbracelet/glamour github.com/charmbracelet/glamour/ansi github.com/charmbracelet/glamour/internal/generate-style-json === RUN TestTermRendererWriter glamour_test.go:59: Rendered output doesn't match! Expected: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `
    Got: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `

--- FAIL: TestTermRendererWriter (0.02s) === RUN TestTermRenderer glamour_test.go:89: Rendered output doesn't match! Expected: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `
    Got: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `

--- FAIL: TestTermRenderer (0.01s) === RUN TestWithEmoji --- PASS: TestWithEmoji (0.00s) === RUN TestStyles --- PASS: TestStyles (0.00s) === RUN TestRenderHelpers glamour_test.go:157: Rendered output doesn't match! Expected: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `
    Got: `

       Gold                                                                       

      Render markdown on the CLI, with pizzazz!                                   

      ## What is it?                                                              

      Gold is a Golang library that allows you to use JSON based stylesheets to   
      render Markdown files in the terminal. Just like CSS, you can define color  
      and style attributes on Markdown elements. The difference is that you use   
      ANSI color and terminal codes instead of CSS properties and hex colors.     

      ## Usage                                                                    

      See cmd/gold /cmd/gold/.                                                    

      ## Example Output                                                           

      Image: Gold Dark Style →                                                    
      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png    

      Check out the Gold Style Gallery                                            
      https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md! 

      ## Colors                                                                   

      Currently  gold  uses the Aurora ANSI colors                                
      https://godoc.org/github.com/logrusorgru/aurora#Index.                      

      ## Development                                                              

      Style definitions located in  styles/  can be embedded into the binary by   
      running statik https://github.com/rakyll/statik:                            

        statik -f -src styles -include "*.json"                                   

      You can re-generate screenshots of all available styles by running          
      gallery.sh . This requires  termshot  and  pngcrush  installed on your      
      system!                                                                     

    `

--- FAIL: TestRenderHelpers (0.01s) FAIL FAIL github.com/charmbracelet/glamour 0.060s === RUN TestRenderer renderer_test.go:94: Rendered output for block_quote doesn't match! Expected: `

    => First line of quote                                                            
    => Second line                                                                    
    `
    Got: `

    => First line of quote                                                            
    => Second line                                                                    
    `
renderer_test.go:94: Rendered output for code doesn't match!
    Expected: `
    This is a code.                                                                 
    `
    Got: `
    This is a code.                                                                 
    `
renderer_test.go:94: Rendered output for emph doesn't match!
    Expected: `
    This text is emphasized.                                                        
    `
    Got: `
    This text is emphasized.                                                        
    `
renderer_test.go:94: Rendered output for enumeration doesn't match!
    Expected: `

    1. First Item                                                                   
    2. Second Item                                                                  
    `
    Got: `

    1. First Item                                                                   
    2. Second Item                                                                  
    `
renderer_test.go:94: Rendered output for heading doesn't match!
    Expected: `
      => h1 <=                                                                      
        ## h2                                                                       
          ### h3`
    Got: `
      => h1 <=                                                                      
        ## h2                                                                       
          ### h3`
renderer_test.go:94: Rendered output for image doesn't match!
    Expected: `
    Image [Image: https://charm.sh/logo.png].                                       
    `
    Got: `
    Image [Image: https://charm.sh/logo.png].                                       
    `
renderer_test.go:94: Rendered output for link doesn't match!
    Expected: `
    This is a link (https://charm.sh).                                              
    `
    Got: `
    This is a link (https://charm.sh).                                              
    `
renderer_test.go:94: Rendered output for list doesn't match!
    Expected: `

    • First Item                                                                    
        • Nested List Item                                                          
    • Second Item                                                                   
    `
    Got: `

    • First Item                                                                    
        • Nested List Item                                                          
    • Second Item                                                                   
    `
renderer_test.go:94: Rendered output for strikethrough doesn't match!
    Expected: `
    Scratch this.                                                                   
    `
    Got: `
    Scratch this.                                                                   
    `
renderer_test.go:94: Rendered output for strong doesn't match!
    Expected: `
    This text is strong.                                                            
    `
    Got: `
    This text is strong.                                                            
    `
renderer_test.go:94: Rendered output for task doesn't match!
    Expected: `

    ✓ Finished Task                                                                 
    ✗ Outstanding Task                                                              
    `
    Got: `

    ✓ Finished Task                                                                 
    ✗ Outstanding Task                                                              
    `

--- FAIL: TestRenderer (0.01s) === RUN TestRendererIssues renderer_test.go:166: Rendered output for 42 doesn't match! Expected: `

      If you want to make a more significant change, please first open an issue   
      https://github.com/twpayne/chezmoi/issues/new to discuss the change that you
      want to make. Dave Cheney gives a good rationale                            
      https://dave.cheney.net/2019/02/18/talk-then-code as to why this is important.

    `
    Got: `

      If you want to make a more significant change, please first open an issue   
      https://github.com/twpayne/chezmoi/issues/new to discuss the change that you
      want to make. Dave Cheney gives a good rationale                            
      https://dave.cheney.net/2019/02/18/talk-then-code as to why this is important.

    `
renderer_test.go:166: Rendered output for 43 doesn't match!
    Expected: `

      • Getting started                                                           
      • Developing locally                                                        
      • Documentation changes                                                     
      • Contributing changes                                                      
      • Managing releases                                                         
      • Packaging                                                                 
      • Updating the website                                                      

    `
    Got: `

      • Getting started                                                           
      • Developing locally                                                        
      • Documentation changes                                                     
      • Contributing changes                                                      
      • Managing releases                                                         
      • Packaging                                                                 
      • Updating the website                                                      

    `
renderer_test.go:166: Rendered output for 46_1 doesn't match!
    Expected: `

      • Navigation                                                                
        • Familiar shortcuts (arrows, ~, -, @), quick reference                   

    `
    Got: `

      • Navigation                                                                
        • Familiar shortcuts (arrows, ~, -, @), quick reference                   

    `
renderer_test.go:166: Rendered output for 47 doesn't match!
    Expected: `

      Example:  <some directory>                                                  

    `
    Got: `

      Example:  <some directory>                                                  

    `
renderer_test.go:166: Rendered output for 48 doesn't match!
    Expected: `

      emoji in text                                                               

      🐙 ⚡ 🐱 = ❤️                                                               

      emoji in header                                                             

      ## 🐙 ⚡ 🐱 = ❤️                                                            

      no emoji in code blocks                                                     

        :octopus: :zap: :cat: = :heart:                                           

      no emoji in inline code                                                     

       :octopus: :zap: :cat: = :heart:                                            

    `
    Got: `

      emoji in text                                                               

      🐙 ⚡ 🐱 = ❤️                                                               

      emoji in header                                                             

      ## 🐙 ⚡ 🐱 = ❤️                                                            

      no emoji in code blocks                                                     

        :octopus: :zap: :cat: = :heart:                                           

      no emoji in inline code                                                     

       :octopus: :zap: :cat: = :heart:                                            

    `

--- FAIL: TestRendererIssues (0.02s) FAIL FAIL github.com/charmbracelet/glamour/ansi 0.055s ? github.com/charmbracelet/glamour/internal/generate-style-json [no test files] FAIL

Can you indicate any corrections for this?

muesli commented 3 years ago

It sounds like you're running this without Go modules enabled.

Can you try it within an actual checkout of glamour?

jpaulo-oliveira commented 3 years ago

can you exemplify how this could be done please?

muesli commented 3 years ago

Make sure you're running Go 1.11+:

go version

Now clone the repo:

git clone https://github.com/charmbracelet/glamour.git
cd glamour
GO111MODULE=on go test -v ./...

The GO111MODULE=on is not strictly necessary, unless you've manually changed this env var beforehand.

jpaulo-oliveira commented 3 years ago

doing with was indicated the result was this:

=== RUN TestTermRendererWriter --- PASS: TestTermRendererWriter (0.01s) === RUN TestTermRenderer --- PASS: TestTermRenderer (0.01s) === RUN TestWithEmoji --- PASS: TestWithEmoji (0.00s) === RUN TestStyles --- PASS: TestStyles (0.00s) === RUN TestRenderHelpers --- PASS: TestRenderHelpers (0.01s) PASS ok github.com/charmbracelet/glamour 0.041s === RUN TestRenderer --- PASS: TestRenderer (0.01s) === RUN TestRendererIssues --- PASS: TestRendererIssues (0.01s) PASS ok github.com/charmbracelet/glamour/ansi 0.043s ? github.com/charmbracelet/glamour/examples/custom_renderer [no test files] ? github.com/charmbracelet/glamour/examples/helloworld [no test files] ? github.com/charmbracelet/glamour/internal/generate-style-json [no test files]

Is this the expected behavior of the tests? what do these lines indicate?

? github.com/charmbracelet/glamour/examples/custom_renderer [no test files] ? github.com/charmbracelet/glamour/examples/helloworld [no test files] ? github.com/charmbracelet/glamour/internal/generate-style-json [no test files]

muesli commented 3 years ago

Yeah, that seems just fine. The lines at the bottom simply mean that there are no test files in these directories.