Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An easy way to test front-end libraries using browserify and mocha

License

NotificationsYou must be signed in to change notification settings

alekseykulikov/browserify-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplify testing of front-end libraries usingbrowserifyandmocha

Features:

  • No config files, just run your tests in terminal with phantomjs or start watch server to test and debug in actual browser;
  • It builds on top oftestem for solid integration with different browsers and platforms;
  • It useswatchify anderrorify for better development experience;

Usage

Install with npm and make sure phantomjs is installed (phantomjs -v):

npm install --global browserify-test

Pass test files tobrowserify-test and enjoy browserified mocha tests:

browserify-test --help  Usage: browserify-test [options] [./test/*.js ...]  Options:    -h, --help                  output usage information    -V, --version               output the version number    -w, --watch                 run watch server on http://localhost:7357    -t, --transform<t1,t2,..>  add browserify transforms    -p, --plugins<p1,p2,..>    add browserify plugins    -b, --browserifyOptions<jsonStringifiedObj>     add browserifyOptions    --testem, --testemOptions<jsonStringifiedObj>   add testemOptionsbrowserify-test# run tests for ./test/*.jsbrowserify-test --watch# start watch server on localhost:7537browserify-test ./path/to/test.js ./path/to/another-test.js# pass test files as argumentsbrowserify-test ./lib/**/test.js# use globsbrowserify-test --transform [ babelify --presets env ] ./path/to/es6-test.js# use transforms

Integration with npm

Addbrowserify-test to your development dependencies:

npm install --save-dev browserify-test

And usenpm scriptsto run your tests in terminal withnpm test or start development watch server withnpm start.

{"scripts": {"test":"browserify-test ./test/index.js","start":"browserify-test --watch ./test/index.js"  },"devDependencies": {"browserify-test":"^3.1.0"  }}

npm hint: you don't need to type./node_modules/.bin/browserify-test to refer on local copy ofbrowserify-test,npm does itautomatically.

Node.js

importrunfrom'browserify-test'run({watch:false,transform:['brsf',['babelify',{presets:'env'}]],files:['./test/file1.js','./test/file2.js'],})// Returns the underlying `browserify` instance

Options

  • files (orentries) - Array - a list of files for browserify
  • watch - Boolean - enable watch server
  • transform (ortransforms) - Array - a list of browserify transform modules
  • plugins - Array - a list of browserify transform modules
  • browserifyOptions - Object - options to pass asbrowserify options
  • testemOptions - Object - options to pass astestem options. Note that besides config-level options, the CLI-level options are also available, as are Testem'shooks which can be used to report ontestem phases); these can be expressed as strings (to execute shell commands) or as callbacks. Callbacks will be passed the Testem config object, any data object for the hook (only currently used for the undocumentedon_change hook, providing afile path property), and a callback which should be invoked with a falsy argument (or no arguments) to indicate a passed Testem test or invoked with a truthy argument (such as an error object) to report a failed Testem test.
  • finalizer - Function called toward end of tests; as in testem, this finalizer will be passed an exit code (set to 0 if normal and 1 if erring) and any(Bluebird) error object. If you wish to execute code prior to the end of all tests, see the docs above on hooks intestemOptions.

License

MIT

About

An easy way to test front-end libraries using browserify and mocha

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp