Mongodb service does not start on windows

Using the same script for linux platform, mongodb tests will give error

failed to connect to server [127.0.0.1:27017] on first connect

here is the travis.yml

language: node_js
os:
  - windows
  - linux
  
node_js:
  - "8"
  - "6"
  - "10"

services:
  - mongodb

notifications:
  email:
    on_success: never
    on_failure: always

I tried adding:

before_script:
  - mongod

but no luck (says unknown command)

Is there anything else that needs to be done on windows?

services in general at the moment assumes Linux.

Hi @cemremengu

We don’t currently pre-install mongodb. You can install it in a before_install step using choco install mongodb, but you will want to add an if condition so that it is only install when TRAVIS_OS_NAME is windows.

1 Like