pdonorio / restangulask

FRONTEND(Flask and Angular interface) + BACKEND(Flask Rest API)
MIT License
3 stars 2 forks source link

Test Suite Installation #20

Closed gianpierobozza closed 3 years ago

gianpierobozza commented 8 years ago

Please install into the docker image the following packages:

Karma: a JavaScript command line tool that can be used to spawn a web server which loads your application's source code and executes your tests Installation: (from docs page) $ npm install karma-jasmine karma-chrome-launcher --save-dev Installs all the dependencies $ npm install -g karma-cli Command line helper, run Karma simply by karma from anywhere and it will always run the local version

Jasmine: behavior driven development framework for JavaScript that has become the most popular choice for testing Angular applications. Installation: (from Github repo)

This should give us a full running environment for testing the Angular JS part of the framework For an official Angular JS guide on testing refer to this page

Gianpiero

pdonorio commented 8 years ago

Installation: (from docs page) $ npm install karma-jasmine karma-chrome-launcher --save-dev Installs all the dependencies $ npm install -g karma-cli

We didn't use the save dev, but installed everything globally instead, for the docker image. Also i see there is some missing dependency (at least nodejs says so) with karma core.

pdonorio commented 8 years ago

Ok, testing what we should do here for the docker image.

# Running Docker nodejs as root
docker run --name nodejs -it --user root pdonorio/jsdev bash

root@dd28614d57f6:/devjs# npm install -g karma karma-cli karma-jasmine karma-chrome-launcher jasmine-core

[...] # installs

root@dd28614d57f6:/devjs# exit

# Running as developer to check binaries
docker exec -it --user developer nodejs bash
developer@dd28614d57f6:/devjs$ karma --version
Karma version: 0.13.22

Great so far.

pdonorio commented 8 years ago

For Jasmine we have to do some refactor, since i found an npm package: https://github.com/jasmine/jasmine-npm

# On the root shell of nodejs
root@dd28614d57f6:/devjs# 

npm install -g jasmine
/usr/bin/jasmine -> /usr/lib/node_modules/jasmine/bin/jasmine.js
/usr/lib
`-- jasmine@2.4.1
  +-- exit@0.1.2
  +-- glob@3.2.11
  | +-- inherits@2.0.1
  | `-- minimatch@0.3.0
  |   +-- lru-cache@2.7.3
  |   `-- sigmund@1.0.1
  `-- jasmine-core@2.4.1

# As developer to check binaries
developer@dd28614d57f6:/devjs$ jasmine init
developer@c48ca39e52b9:/devjs$ more spec/support/jasmine.json
{
  "spec_dir": "spec",
  "spec_files": [
    "**/*[sS]pec.js"
  ],
  "helpers": [
    "helpers/**/*.js"
  ],
  "stopSpecOnExpectationFailure": false,
  "random": false
}
pdonorio commented 8 years ago

@gianpierobozza probably this is enough.

If you're ok i will go with Docker image modification as described above.

gianpierobozza commented 8 years ago

All good, please install it in the docker image :+1:

pdonorio commented 8 years ago

Pushed modifications for the docker image.

We can check here the automatic build, and see when it's ready: https://hub.docker.com/r/pdonorio/jsdev/builds/

pdonorio commented 8 years ago

Build is available. We should see how to run the tests inside one of the restangulask blueprint. I must use a service inside the docker-compose to do so.

pdonorio commented 8 years ago

Ok so installation is fine. We must create a setup to use it.

We need a ./do command based on docker-container to launch a bash on nodejs to run karma.

Problems i see:

pdonorio commented 8 years ago

Ok, karma command is avaialble:

./do graphbased karma

This opens a shell as "developer" inside the nodejs container. @gianpierobozza may use karma init there. The thing to verify as soon as possible, to close this issue, is what to do with blueprint.js

gianpierobozza commented 8 years ago

thanks @pdonorio

is it possible that before the shell is opened the ./do command creates the blueprint.js based on

I see just a few parameters in blueprint.js, so maybe the first approach is okay at the moment, but if the number of params increase the second approach might be better

pdonorio commented 8 years ago

Usually the ./do command makes the python server create the right parameters inside the blueprint.js. So we may probably produce it somehow (i don't know yet how, i must check the jinja2 documentation).

If this approach works we may do something similar with the json file, since python reads easily json. Just try like this right now and see what errors you get.