Giter Club home page Giter Club logo

redirect-test's Introduction

redirect-test

NPM version Build Status Code Climate Test Coverage Issue Count Dependency Status

Test your redirects and get an easily readable and parsable csv file back. Testing a lot of redirects is hard and this cli aims to make it easier and less time consuming.

Install

yarn

$ yarn global add redirect-test

npm

$ npm i -g redirect-test

Usage

redirect-test <file> <url> [options]

Required fields

file: A csv file in the following format: old-URI,new-URI eg. /about-bob,/about/bob

url: The URL must be the final URL for the site. If it is not the redirect will get caught to early by conditionals such as non-www -> www and http -> https. Since this tool is not meant to test those types of redirects you will want to use the proper FQDN. eg. https://example.com

Options

-c, --csv: This will allow you to output to a custom csv file name and path. Default: ./results.csv

-q, --quiet: This will limit the console output to only print the csv file path.

-n, --number: The number of concurrent requests to make to the testing URL at a time. Default: 5

Results

Screenshot

Tests

yarn

yarn test

If you want to dev locally and run tests on file changes you can run the following.

yarn test-local

NOTE: I politely ask that all pull requests have proper tests otherwise you will be asked to add them.

License

MIT © 2017 Charlie Pitkin

redirect-test's People

Contributors

cpitkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

redirect-test's Issues

New URL needs to be trimmed when parsing csv file

When parsing the input CSV file the new and old URLs are not trimmed. This created a false positive failure when the cli expects the location header to accommodate the extra spaces. See example output below

input command : redirect-test 301s.csv https://example.com -a username:password

old,new,status_code,actual_url
/brunch/,/visit ,301,/visit
/columbia-gorge-wine-tasting-in-portland/,/visit ,301,/visit
/columbia-gorge-wine-card/,/visit ,301,/visit
/hoodriver/,/visit ,301,/visit
/portland/,/visit ,301,/visit
/summer-hours-at-our-hood-river-tasting-room/,/visit ,301,/visit
/newcerulean/portland/,/visit ,301,/visit
/newcerulean/hoodriver/,/visit ,301,/visit
/newcerulean/wineclub/,/visit ,301,/visit

Add option to skip the first line for headers

The first line should be skipped with parsing the CSV. Since the headers are present in the first line we need an option that allows you to skip the first line if headers are present.

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.