Coder Social home page Coder Social logo

mix-phxtest's Introduction

mix phxtest

Mix task for running specific tests in your phoenix project via mix test (ex_unit) and mix watch (mix-test.watch) more conveniently.

Let's admit it, we're all lazy and running specific tests in a phoenix project can be a bit of a hassle when specifying the full path. I for one, would prefer to strip the boilerplate text from the command. So, here's a fitting library.

# Stop doing this
$ mix test test/myapp_web/controllers/resource_controller.exs:12

# Start doing this
$ mix phxtest c resource 12

Just add mix_phxtest as a dependency to your project via hex.pm

{:mix_phxtest, "~> 0.2.2", only: [:test]}

Usage

Usage: mix phxtest <type> <name> [line]
       mix phxwatch <type> <name> [line]

type:  c - controller (/test/myapp_web/controllers/)
       v - view       (/test/myapp_web/views/)
       p - plug       (/test/myapp_web/plug/)
       w - web        (/test/myapp_web/)
       l - lib        (/test/myapp/)

name:  The name of your file, you can add additional
       subdirectories here, if needed.

line:  The line of the test, if you only want to execute
       a single test. This is optional.
       

idea:  The phx.test and phxwatch are just aliases that
       perform simple string interpolation. The commands
       you are generating are composed like this:
       $ mix phxtest c user 12
       $ mix test /test/controllers/user_controller_test.exs:12

Hint: You can access nested tests by putting the path in the name parameter:

$ mix phxtest c device/mobile 11

# Will become
$ mix test test/myapp_web/controllers/device/mobile_controller_test.exs:11

mix-phxtest's People

Contributors

cybrox avatar

Watchers

 avatar  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.