GithubHelp home page GithubHelp logo

kayger44 / xunit-viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukejpreston/xunit-viewer

0.0 1.0 0.0 7.11 MB

View your xunit results using JavaScript

License: MIT License

JavaScript 22.66% HTML 77.15% CSS 0.19%

xunit-viewer's Introduction

Xunit Viewer

Icon

npm version Downloads on npm

Takes your XMl xunit results and then turns it into a nice single HTML file

Have a look at the demo

Have a look at the v6 demo It isn't complete but if you are interested in an early look at what new features might be available and the new layout/styles please feel free

CLI

You can use xunit-viewer from the command line

First install it

npm i -g xunit-viewer

Then run it

xunit-viewer

you can also run it with these optional params, see the next section for what they default to

--results=file_or_folder
--ignore=pattern_a,pattern_b,pattern_c
--output=file_or_folder_or_console
--title="The title"
--port=8080
--watch
--color=false
--filter.suites.value="Suite names matching this value"
--filter.suites.types=all,pass,fail,skip,error,unknown
--filter.tests.value="Test names matching this value"
--filter.tests.types=all,pass,fail,skip,error,unknown
--filter.properties.value="Properties matching with key or value matching this value"
--filter.properties.types=all

Node

If you want to run this from a node script instead of command line first install it

npm i -D xunit-viewer

Then from your scripts do the following

const XunitViewer = require('xunit-viewer/cli')
const result = XunitViewer({
    results: '',
    suites: [],
    xml: '',
    ignore: [],
    output: false,
    title: 'Xunit Viewer',
    port: false,
    watch: false,
    color: true,
    filter: {},
    format: 'html'
})

all are optional, those are default values

  • results the file or folder where the results are, defaults to where the cli is running from i.e. process.cwd()
  • suites you can pass the JSON format in after using the parser
  • xml you can pass the xml string in
  • ignore an array of patterns to ignore or a single string with a pattern to ignore
  • output if folder will save a file xunit-viewer.html to that folder, if a file will save to that file if 'console' then it will spit out the results to the console
  • title title for the HTML
  • port if false it will not start a server, otherwise it will start serving the output and not save not save a file unless you also provide output
  • watch will re run the cli when anything in results changes, if you have a port it will also update that via websockets
  • color if output === 'console' then it will either be in color or not
  • filter will filter out suites, tests and properties from the console output example
{
    "suites": {
        value: "Suite names matching this value",
        type: ["all", "pass", "fail", "skip", "error", "unknown"],
    },
    "tests": {
        value: "Test names matching this value",
        type: ["all", "pass", "fail", "skip", "error", "unknown"],
    },
    "properties": {
        value: "Properties matching with key or value matching this value",
        type: ["all"]
    },
}
  • format default to html which is the full HTML file, but you can also choose json if you want to use that json for your own view

if any value is invalid it will try and use default

Component

You will need to bring in React if you are using the component

It works best with webpack setup but you should be able to work it out if you need to

This is the view which you can reuse

import React from 'react'
import XunitViewer from 'xunit-viewer/component/xunit-viewer'
import 'xunit-viewer/component/index.css'

let MyWrapper = () => {
    return <XunitViewer xml='' suites={[]} title='' />
}

Junit Viewer

This has replaced Junit Viewer which is now deprecated this.

Why?

Better API Better View Uses React Nested Suites Using sockets and lighter

TODO

  • add a repl
  • meta data for slack
  • make better stub data
  • better error handling
  • set up something which will parse in browser
  • clean everything and write some more tests

xunit-viewer's People

Contributors

lukejpreston avatar mfurtado-mdsol avatar leboff avatar jan-molak avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.