ericmdantas / generator-ng-fullstack

Client, server or fullstack - it's up to you. ng-fullstack gives you the best of the latest.
MIT License
704 stars 103 forks source link

Travis-ci builds fail out of the box due to missing script 'test-on-travis' #174

Closed jensim closed 6 years ago

jensim commented 8 years ago

https://travis-ci.org/jensim/myStreamWeb

0.40s$ npm run-script test-on-travis
npm ERR! Linux 3.13.0-40-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v5.11.1/bin/node" "/home/travis/.nvm/versions/node/v5.11.1/bin/npm" "run-script" "test-on-travis"
npm ERR! node v5.11.1
npm ERR! npm  v3.8.6
npm ERR! missing script: test-on-travis
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/build/jensim/myStreamWeb/npm-debug.log
The command "npm run-script test-on-travis" failed and exited with 1 during .
Your build has been stopped.

My .yo-rc.json:

{
  "generator-ng-fullstack": {
    "username": "jensim",
    "appName": "myStreamJS",
    "stack": "fullstack",
    "server": "node",
    "client": "ng2",
    "transpilerServer": "typescript",
    "secure": true,
    "differentStaticServer": false
  }
}
ericmdantas commented 8 years ago

Hello, @jensim. Thanks for pointing it out.

I moved some things around and might've forgotten about this one.

Can you please change the content of the travis file for the following:

language: node_js

node_js:
  - "stable"

before_script:
  - npm install -g typings typescript istanbul gulp-cli mocha
  - typings install
  - tsc

script:
  - npm run test-server

services: mongodb

Just to see if travis didn't change a few things that used to work.

Also, keep in mind that if you're testing ng2 too, the build will fail because of #101.

jensim commented 8 years ago

Thanks for the information about #101

Build passed! =) https://travis-ci.org/jensim/myStreamWeb/builds/139450840

ericmdantas commented 8 years ago

Right, but it didn't run any tests, though.

Can you try npm run test-server locally, please? It should run 5 tests.

jensim commented 8 years ago
 $ npm run test-server

> myStreamJS@0.0.1 test-server /Users/jensim/workspace-git/myStreamWeb
> mocha ./tests/server/**/*.js --recursive --check-leaks --reporter min --compilers js:babel-register

  0 passing (2ms)

Not really sure what this tells us, the "0 passing" part is painted green.


PS This is a bit off topic though, this is related to #101

ericmdantas commented 8 years ago

101 is about ng2, it should not interfere with the server tests.

I'll investigate it when I get home.

ericmdantas commented 8 years ago

So, I just ran the tests locally and got the following:

  5 passing (194ms)

Do you have mocha installed globally? If so, what's the version (mocha --version)? Also, when you're running the tests, do you have mongod running? If not, you should.

jensim commented 8 years ago

That might be it.. At work now and am unable to check. I see now that mocha is declared in the wiki as a dependency for the node-server setting, could this be inserted into the generated README.md for the generated project?

npm i -g istanbul mocha babel gulp-cli
ericmdantas commented 8 years ago

I mean, npm should pull the mocha dependency in the package.json: https://github.com/ericmdantas/generator-ng-fullstack/blob/master/app/templates/_package.json#L80, but it's good to know there's no conflict.

By the way, I just uninstalled mocha globally, just running it locally and it still passes the tests.

Just for sanity check: You compiled the .ts files (by running tsc), you can use the app, but only the server tests aren't running, right?

jensim commented 8 years ago

I dont think i ran tsc... Could that be built in as a post install command or something (in the package.json)?

ericmdantas commented 8 years ago

It runs when you run npm run dev. But a postinstall is ideal, so we can run typings install and tsc.

But, did you manage to run the app?

zerozero commented 8 years ago

I am having exactly the same problem. The app runs ok and using the modified .travis.yml above I can get the test passing on travis-ci.org but it reports 0 passing (2ms) in green. I get the same result running the server tests locally. I have the latest mocha installed globally (2.5.3), I have run tsc, I have mongod running..

Any ideas? thanks

ericmdantas commented 8 years ago

@zerozero if you add a console.log('something') in one of the tests, does it show in the terminal?

zerozero commented 8 years ago

No there is nothing logged in the console from any of the tests or the before block

ericmdantas commented 8 years ago

That's really weird. I'll try to reproduce it again.

zerozero commented 8 years ago

Hi Eric - the problem is that 'due to shell expansion, glob patterns should be wrapped in single quotes on unix shells.' https://github.com/mochajs/mocha/issues/1115 so changing the test-server value to "test-server": "mocha './tests/server/*/.js' --recursive --check-leaks --reporter min --compilers js:babel-register" (note the single quotes around the glob pattern) fixes the tests Thanks

ericmdantas commented 8 years ago

@zerozero: Oh, I'd never catch that one - thanks for pointing it out.

I'll fix it later today and release a patch.

ericmdantas commented 8 years ago

1.8.17 released.

SebaSOFT commented 8 years ago

This is still not resolved. My .yo-rc.joson

{
  "generator-ng-fullstack": {
    "username": "SebaSOFT",
    "appName": "AchievePlay",
    "stack": "fullstack",
    "server": "node",
    "client": "ng1",
    "transpilerServer": "node",
    "secure": true,
    "differentStaticServer": false
  }
}

Also npm run test-server doesn't run locally on Windows. I guess not all is platform agnostic.

ericmdantas commented 8 years ago

Hey there, @SebaSOFT.

What happens when you run it? Do you have mongod running?

SebaSOFT commented 8 years ago

fixed, its a couple of things.

ericmdantas commented 8 years ago

Cool :smile: