Giter Club home page Giter Club logo

starrynight's Introduction

StarryNight

Scaffolding and testing tool for creating HIPAA and FDA compliant Meteor apps.

===============================

What is StarryNight?

StarryNight is a command line tool for use in scaffolding and testing Meteor applications. It's similar to tools like 'rails generate', 'spacejam', and 'mrt'. It's a direct result of 2 years of working on the Meteor Cookbook.

New Location: Please note that we've moved to starrynight.meteorapp.com

===============================

Installation

npm install starrynight -g

===============================

Usage

  autoconfig
  run-tests --type <testType>
  run-tests --framework <frameworkName> --autogenerated
  generate-release-json
  generate-application-json
  display-env
  audit-permissions
  compact
  scaffold --boilerplate <boilerplateName> --framework <frameworkName>
  pattern --url http://github.com/account/repo
  rename --from <originalTerm> --to <newTerm> -root <directoryRoot>
  find-and-replace --from <originalTerm> --to <newTerm> -root <directoryRoot>
  refactor --from <originalTerm> --to <newTerm> -root <directoryRoot>
  create --package foo:mypackage --from /path/to/component
  extract-ids /path/to/<filename>
  extract-classes /path/to/<filename>
  extract-tests-for /path/to/<filename>
  generate-ci  --provider <ciProviderName>

===============================

Testing Quickstart

# fetch files for local development (as definined in .git-packages.json)
$ starrynight fetch

# add .meteor/starrynight.json to our application
$ starrynight autoconfig

# run your application validation tests using NightWatch
$ starrynight run-tests --type validation

# run your application verification tests using Gagarin
$ starrynight run-tests --type verification

# run your package-verificaiton tests using Gagarin
$ starrynight run-tests --type package-verification

# (optional) add verification & integrations tests to your application
$ starrynight scaffold --framework nightwatch

===============================

Licensing

MIT License

starrynight's People

Contributors

awatson1978 avatar hwillson avatar martinhbramwell avatar meonkeys avatar mhb-warehouseman avatar mokolodi1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

starrynight's Issues

split commands into separate files

There's almost a dozen commands already, with another dozen on their way. This is going to quickly need to be broken out into separate files, just so we can keep things organized. Hard linking with 'require' or 'import' statements in this tool seems like it would be totally fine.

Error: spawn ENOENT

Following through the steps on the StarryNight tool's web page I have hit a snag.

yourself@qtst:~/projects/helloworld$ starrynight -survey acceptance
Launching StarryNight.  Analyzing meteor environment...
Detected a meteor instance...
Launching nightwatch bridge...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:988:11)
    at Process.ChildProcess._handle.onexit (child_process.js:779:34)

yourself@qtst:~/projects/helloworld$ meteor update
This project is already at Meteor 1.1.0.2, the latest release.
Your packages are at their latest compatible versions.

yourself@qtst:~/projects/helloworld$ cat /etc/issue
Ubuntu 14.04.2 LTS \n \l

yourself@qtst:~/projects/helloworld$ npm --version
1.3.10

Any ideas?

Nightwatch bridge and/or other processes do not stop on errors when starting the test runner

Hi Abigail,

Firstly, thanks for building out this tool! Velocity is rubbish and I'm hoping starrynight is the test framework for me. The doc look good.

Just having a little trouble getting started. In the process of trying to get everything started, it seems that if I have a fatal error when starting starrynight, not all processes that it spawns die and on the subsequent connection, the port is taken.

$ starrynight run-tests --framework tinytest-ci                                                                              
This command should be run in the root of an application.
Running tiny tests on packages.  Check http://localhost:3000
multiFramework::options { _: [ 'node', '/usr/local/bin/starrynight', 'run-tests' ],
  framework: 'tinytest-ci' }
Detecting release version...
Spawning Meteor instance on port 3300 for Package Verification testing using TinyTest...
I20150707-12:27:23.543(10)? test-in-console listening
Detected a meteor instance on port 3300
Launching nightwatch bridge...
ERROR There was an error while starting the test runner:



Error: Failed to load external global file: External global file could not be located - using ./tests/nightwatch/globals.json.
    at Object.CliRunner.readExternalGlobals (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:130:13)
    at Object.CliRunner.initTestSettings (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:383:10)
    at Object.CliRunner.parseTestSettings (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:363:10)
    at Object.CliRunner.init (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:31:8)
    at module.exports.runner.runner [as runner] (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/index.js:512:19)
    at /usr/local/lib/node_modules/starrynight/node_modules/nightwatch/bin/runner.js:9:16
    at module.exports.cli.cli [as cli] (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/index.js:504:7)
    at Object.<anonymous> (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/bin/runner.js:8:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Nightwatch exited with a code of 2

Then on the subsequent attempt

$ starrynight run-tests --framework tinytest-ci
This command should be run in the root of an application.
Running tiny tests on packages.  Check http://localhost:3000
multiFramework::options { _: [ 'node', '/usr/local/bin/starrynight', 'run-tests' ],
  framework: 'tinytest-ci' }
Detecting release version...
Spawning Meteor instance on port 3300 for Package Verification testing using TinyTest...
Can't listen on port 3300. Perhaps another Meteor is running?

Running two copies of Meteor in the same application directory
will not work. If something else is using port 3300, you can
specify an alternative port with --port <port>.
Package Verification Testing exited with code 254
Detected a meteor instance on port 3300
Launching nightwatch bridge...
ERROR There was an error while starting the test runner:



Error: Failed to load external global file: External global file could not be located - using ./tests/nightwatch/globals.json.
    at Object.CliRunner.readExternalGlobals (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:130:13)
    at Object.CliRunner.initTestSettings (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:383:10)
    at Object.CliRunner.parseTestSettings (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:363:10)
    at Object.CliRunner.init (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/runner/cli/clirunner.js:31:8)
    at module.exports.runner.runner [as runner] (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/index.js:512:19)
    at /usr/local/lib/node_modules/starrynight/node_modules/nightwatch/bin/runner.js:9:16
    at module.exports.cli.cli [as cli] (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/lib/index.js:504:7)
    at Object.<anonymous> (/usr/local/lib/node_modules/starrynight/node_modules/nightwatch/bin/runner.js:8:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Nightwatch exited with a code of 2
$ ps -ef | grep meteor                                                                                                              
e         7734  1091  0 12:27 pts/19   00:00:03 /home/e/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node /home/e/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/tools/main.js test-packages --once --driver-package test-in-console -p 3300
e         7756  7734  0 12:27 pts/19   00:00:01 /home/e/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/mongodb/bin/mongod --bind_ip 127.0.0.1 --smallfiles --port 3301 --dbpath /tmp/meteor-test-runa8p3d5/.meteor/local/db --oplogSize 8 --replSet meteor
e         7814  7734  0 12:27 pts/19   00:00:00 /home/e/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node /tmp/meteor-test-runa8p3d5/.meteor/local/build/main.js
e         8357  3632  0 12:34 pts/19   00:00:00 grep meteor

Hopefully its just something crazy I have done wrong and there is no actual underlying bug.

Thanks,
Elliott

starrynight -connect [uservoice | zapier | google-analytics]

There's a few services that people commonly like to connect their applications to, such as google-analytics and uservoice, which only require a single file copied into their app. This will get those files in place without having to research things.

ReferenceError: runPioneer is not defined

ReferenceError: runPioneer is not defined
    at module.exports (/usr/local/lib/node_modules/starrynight/tool/run-tests.js:53:7)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/starrynight/bin/starrynight.js:183:9)
    at process._tickCallback (node.js:419:13)

-clone-package

Clones a package into the /packages directory. Convenience function so you don't have to swap directories to run the clone command.

starrynight -run-framework

Runs a specific testing framework. General alias for survey and run-tests, but let's you pass in framework specific options and arguments.

lstat doesn't exist on windows

Re: robfallows

TL;DR: I got StarryNight installed, but couldn't get it to run. YMMV.

So, I finally have something to report wrt Windows. I stripped Windows back to a bare installation to find out what a Windows developer might need to install prior to installing StarryNight.

Prerequisites:

  1. nodejs and npm. Don't do what I did and install the latest version of node. Things will break. I eventually installed our old friend version 0.10.36. I used the msi file from http://nodejs.org/dist/v0.10.36/, which also installs npm 1.4.28.
  2. python. I installed version 2.7 from https://www.python.org/downloads/release/python-2710/. Version 3.4.3 might work - I didn't try.
  3. You need a C compiler. I installed Microsoft Visual Studio Community 2013 from https://www.visualstudio.com/products/visual-studio-community-vs. Other C compilers might work, I don't know. The errors I saw prior to installing this referenced Visual Studio, so I took the route of least pain (but probably longest ever installation time). You should check the licence if you are using it commercially.
  4. Check your PATH settings. node and npm seemed to set this up for me. So did Visual Studio, after a reboot, but python didn't. If you don't know where to check/set, click the Windows button, right click on Computer, select properties -> advanced system settings -> Environment Variables (Win7).
    From here, you can now open up a command prompt and install starrynight:

npm install -g starrynight

During this I got a handful of warnings:

warning C4506: no definition for inline function 'v8::Persistent<v8::Object> v8::Persistent<v8::Object>::New(v8::Handle<v8::Object>)' [C:\users\***\AppData\Roaming\npm\node_modules\starrynight\node_modules\pioneer\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\users\***\AppData\Roaming\npm\node_modules\starrynight\node_modules\mrtbulkrelease\node_modules\sync-prompt\build\sync_prompt.vcxproj]

However, the installation completed ok smile, although on my core i5 laptop it took 3 hours worried!

Unfortunately, when I tried to add the nightwatch scaffolding:

starrynight scaffold --framework nightwatch

I got the following error:

Starting scaffolding of nightwatch tests...

{ [Error: ENOENT, lstat 'C:\Users\rfallows\AppData\Roaming\npm\lib\node_modules\starrynight\scaffolds\sample-tests\nightwatch']
  errno: 34,
  code: 'ENOENT',
  path: 'C:\\Users\\rfallows\\AppData\\Roaming\\npm\\lib\\node_modules\\starrynight\\scaffolds\\sample-tests\\nightwatch' }

The issue seems to be with no lstat command in Windows. I have checked cygwin, GnuWin and MinGW and cannot find a Windows equivalent. Currently stuck!

nightwatchjs.org iframe

Add second window/iframe to encapsulate Nightwatch API page. Break point to display second iFrame should be ~1740px (ie. 1440px + 300px).

hard-coded npm prefix in nightwatch config

configs/nightwatch/config.json has "server_path" : "/usr/local/lib/node_modules/starrynight/node_modules/selenium-server-standalone..., but it should use the npm prefix instead of /usr/local.

On my system, prefix is /usr, so I get this error:

$ starrynight -survey acceptance
Launching StarryNight.  Analyzing meteor environment...
Detected a meteor instance...
Launching nightwatch bridge...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1011:11)
    at Process.ChildProcess._handle.onexit (child_process.js:802:34)

I don't know if nightwatch has a way to use environment or command-line variables in the config file, so it may be necessary to pre-process the config file to use a dynamic npm prefix.

Found while testing PR #3.

starrynight -compress

Recursively searches for .meteor/local/build directories and deletes them. Can save many GB of space.

Linting

Linting

Did you see Sashko's esLint suggestion? https://forums.meteor.com/t/eslint-configuration-for-official-mdg-style/271/5 He isn't the first I have seen recommend AirBnB's coding standard, so I think it makes sense to use it.

However, there are many little details to consider :

  • Maybe we should address only the boilerplate code at first. Code quality being an important aspect of Starrynight, it's self-contradictory not to ensure that the boilerplate, at least, has a consistent coding style.

  • The quotes vs double quotes debate rages on. AirBnB goes for single-quote. It's your choice, of course! I think it does not matter all that much which you choose, but I think choosing does matter for the StarryNight boilerplate. If someone does a global search and replace with a pattern containing a quote or double quote, the results have to be consistent, right?

  • Git diff leaves everyone pretty much stranded when reviewing the effects of a massive linting job on a file. You may want to think about how bad that would be &/or how to manage that. You can see it in my commit "A first try with esLint".

  • How is StarryNight's test coverage? If a linting exercise on a file broke something, would your tests catch it?

  • The main stylistic issues I have seen so far in StarryNight are :

    error    Multiple blank lines not allowed                                 **no-multiple-empty-lines**
    error    Expected space or tab after // in comment                        **spaced-line-comment**
    error    Missing space before opening brace                               **space-before-blocks**
    error    Missing space before value for key "click .addFooItem"           **key-spacing**
    error    All "var" declarations must be at the top of the function scope  **vars-on-top**
    
  • Others are "defensive programming" defences, that make a lot of sense to me.

    error    {variable} used outside of binding context                       **block-scoped-var**
    error    {variable} is defined but never used                             **no-unused-vars**
    error    Missing trailing comma                                           **comma-dangle**
    warning  Unexpected console statement                                     **no-console**
    error    {variable} is not defined                                        **no-undef**
    error    Unexpected var, use let or const instead                         **no-var**
    error    Strings must use singlequote                                     **quotes**
    
  • Can you see if there is a way to get eslint into your editor? Mine, in Sublime Text, highlights and describes all linting error and warnings. Please see this wiki page of my fork produced by running this command --

    eslint tool/generate-nightwatch-config.js
    

New Documentation Checklist

The new documentation is going to be heavily inspired by the Nightwatchjs.org website.

  • USAGE
  • QUICKSTART
  • ARCHITECTURE
  • TUTORIAL
  • Overview
    • Validation vs Verification Testing
    • Adding Nightwatch to Your App
    • Running Frameworks
  • Basic Validation Testing
    • App Surface Coverage
    • Component Surface Coverage
    • Testing Component Output
    • Testing Component User Input
    • Generating Design Documentation (BDD)
  • Business Validation Testing (Intermediate)
    • Behavior Driven Development
    • System Specification Documents
  • Isomorphic Validation Testing (Advanced)
    • Configuration Autogeneration
    • Running Validation Tests Across Both Packages and Apps
    • Package Validation and Verification Testing
    • Integration Testing Between a Packages
    • Package Only Apps
  • Basic Verification Testing
    • Client-Side Unit Tests
    • Server-Side Unit Tests
  • Isomorphic Verification Testing
    • Running Verification Tests Across Both Packages and Apps
    • Server, Client, and Package Verification Testing
    • Package Only Apps
  • Miscellaneous
    • Testing URLs
    • Testing Meteor Methods
    • Multi-Window PingPong Testing
  • EXAMPLES
  • API
  • FAQ
  • INSTALLATION
    • Prerequisites
    • Windows

Debugging Tools

Adding Kadira support seems like it's an obvious need. My plan had been to add it as a scaffold. Something along the lines of:

# scaffold command, because there's a config file that needs to be generated
starrynight scaffold --service kadira

# add command would be more semantic; but I'm not sure how that would work
# maybe a prompt where one specifies the API key? 
starrynight add --service kadira

# and eventually other debugging services, like splunk
starrynight scaffold --service splunk

# and other services that require a package and a config file
starrynight scaffold --service google-analytics

I've also been considering how to add the Meteor Toys debugging packages . Maybe the following?

starrynight add-debugging-tools

Logging

As per Martin:

Logging

With Bunyan or Winston, it is very beneficial and mercifully easy to not use console. (You might want to skim this comparison.) Please see these pages :

If you want to review my changes to generate_autoconfig.js you will need to run :

  sudo npm install -g bunyan

-extract-ids

Extracts element ids from the specified file, and generates a nightwatch command file. Best used on a component html file to generate a corresponding component test command that will inspect that component.

-display-env

Displays the current value of all known Meteor environment variables.

starrynight -generate component

Runs a scaffold command followed by a refactor command. If a url is specified, runs a pattern command followed by a refactor.

On documentation

Hi Abigail,

Thanks for your efforts!
In the docs I did not find your email, so I started this issue instead.

I've just given starrynight a try and these are my notes on the docs.

starrynight.meteor.com

  • Is this a github site?
    So you can get help spotting and fixing the docs.
  • Version number at the top is 0.2.6.1
    Shouldn't i be 3.2.6.1?
  • It is not clear where to start
    I suppose the examples in the doc site.
  • Is people encouraged to create issues and help with pull requests?
    I guess so, but it wouldn't hurt to state it.
  • How do you run nightwatch unittests?
  • What database will the tests connect to?
    Can I specify a different one than the default? How?

github.com/awatson1978/starrynight

  • The readme is different than the documentation site.
    Maybe keep a really simple readme pointing to the doc site?
  • There is no reference to the documentation site.

General questions

I see in the generated nightwatch.json that tests can be run with phantomjs. How?

As starrynight did not install on OSX, I created a Meteor project in cloud9 (Ubuntu). But I did not manage to get Nightwatch connecting to selenium. It would be good with a checklist of things to check for troubleshooting.

At the end of the day, I still did not manage to get nightwatch tests running.

starrynight -clean

Similar to meteor reset, but doesn't dump the database. Clears the following directories: .meteor/local, .temp, .demeteorizer.

-publish-package

The default meteor publish command can't run from within the /packages directory, because meteor will detect the parent .meteor directory and bork things. package-publish will copy the package up two directories into a .temp directory and publish from there, then clean things up. Allows you to develop a package from with the /packages directory.

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.