npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xunit-to-nunit

v0.4.0

Published

Converts C# XUnit tests to NUnit tests

Downloads

562

Readme

xunit-to-nunit

npm version circleci status Build Status Dependencies

NPM

Converts C# XUnit tests to NUnit tests.

Disclaimer: Far from perfect - something I used as a quick hack to convert loads of large tests

Links

:package: Installation

npm install xunit-to-nunit

Usage

Require

var x2n = require('xunit-to-nunit')

Convert test from string

var nunitTest = x2n.convertCode(xunitTest)

Convert test from file

x2n.convertFile('xunit-source-path.cs', 'nunit-destination-path.cs')

Convert tests from directory

x2n.convertFiles('xunit/source/directory', 'nunit/destination/directory')

This function calls convertFile for all files in the source directory.

Options

convertFiles has a third (optional) parameter: options. This should be a dictionary value, containing all or any of the following parameters:

:wrench: recursive (default: false)

Set to true, this parameter will convert tests in all subdirectories including those at the source root. Directory structure is maintained at the conversion destination.

:wrench: verbose (default: true)

When true, the module logs an info message to the terminal when a file is converted. When a file conversion fails, a error log message is displayed regardless of the value of verbose.

For example,

var options = {
  recursive: true,
  verbose: false
}

x2n.convertFiles('xunit/source/directory', 'nunit/destination/directory', options)

Writing converted tests to source directory

When source = destination, '_NUnit' is appended to the filename. For example, where destination = dir, dir/SomeTests.cs is converted and the result is written to dir/SomeTests_NUnit.cs.

This behaviour can be changed with the following parameters:

:wrench: append (default: '_NUnit')

String to be appended to filenames when writing destination files to the source directory.

:wrench: overwrite (default: false)

If overwrite = true, append is ignored, and source files are overwritten at destination.

For example,

// Append destination filenames with `append` text
var options = {
  append: '_Test',
  overwrite: false // `overwrite` is false by default
}

// or, overwrite source files
var options = {
  overwrite: true
}

x2n.convertFiles('xunit/source/directory', 'nunit/destination/directory', options)

Contributing

Feel free to add things / suggest things to be added by either opening an issue or by submitting a pull request.

References

  • https://xunit.github.io/docs/comparisons.html