Signal-desktop: Unable to run unit tests via `yarn test`

Created on 3 Sep 2018  路  11Comments  路  Source: signalapp/Signal-Desktop

  • [X] I have searched open and closed issues for duplicates

Bug description

I followed the Contribution instructions to get set up for development. When I tried to run yarn test, the unit tests hang for several minutes without any feedback. I do see the Electron icon pop up in my Dock, but I can't open it to see the test status. What am I doing wrong here?

Steps to reproduce

  1. clone Signal-Desktop repository to "Signal-Desktop"
  2. make sure current Node version matches .nvmrc contents
  3. install packages with yarn install --frozen-lockfile
  4. Generate assets with yarn grunt && yarn icon-gen
  5. Run yarn test

Actual result:

Tests hang on unit tests, i.e. `Running "unit-tests" task'

Expected result:

Tests complete

Screenshots

screen shot 2018-09-02 at 3 43 40 pm

screen shot 2018-09-02 at 3 43 56 pm

Platform info

Signal version:

N/A (cloned directly from repository)

Operating System:

OSX 10.11.6

Linked device version:

N/A

Link to debug log

N/A

Edit: After about an hour, I receive this output ten times:

Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' }
NODE_ENV test
NODE_CONFIG_DIR /Users/derek/git/js/Signal-Desktop/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME undefined
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
userData: /Users/derek/Library/Application Support/Signal-test
config/get: Successfully read user config file
config/get: Did not find ephemeral config file, cache is now empty object
making app single instance
quitting; we are the second instance

Followed by:

Fatal error: Something went wrong: Client initialization failed after 10 attempts: RuntimeError Client initialization failed after 10 attempts:  Error: ESOCKETTIMEDOUT

I do not have another instance of Signal running; I ran these tests right from restart, and Signal doesn't start up automatically.

Need Information

Most helpful comment

@serifreedom yarn transpile or yarn grunt and then you should be able to run the tests.

All 11 comments

What happens when you run NODE_ENV=test yarn start?

@scottnonnenberg Here's the output:

yarn run v1.9.4
$ electron .
Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' }
NODE_ENV test
NODE_CONFIG_DIR /Users/derek/git/js/Signal-Desktop/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME undefined
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
userData: /Users/derek/Library/Application Support/Signal-test
config/get: Successfully read user config file
config/get: Did not find ephemeral config file, cache is now empty object
making app single instance
{"name":"log","hostname":"denali.local","pid":18091,"level":30,"msg":"app ready","time":"2018-09-04T18:11:09.616Z","v":0}
{"name":"log","hostname":"denali.local","pid":18091,"level":50,"msg":"Uncaught error or unhandled promise rejection: Error: SQLITE_NOTADB: file is not a database","time":"2018-09-04T18:11:09.636Z","v":0}

...before it hangs

Delete ~/Library/Application Support/Signal-test and it should work again.

Thanks Scott! That did it.

In my case yarn test always show :

image

But NODE_ENV=test yarn start show :

image

@serifreedom You might need to run yarn clean-transpile then yarn grunt and then things will start working again.

@scottnonnenberg-signal command yarn clean-transpile not works

image

The only way I've tried and works, delete all old test files in throw err path : Error: Cannot find module '../../xxx'

Thanks anyway.

@serifreedom Try rm -rf ./ts then git checkout ts and it should work. The problem you're running into is old, cached js files which were compiled from typescript.

@scottnonnenberg-signal still error:

image

@serifreedom yarn transpile or yarn grunt and then you should be able to run the tests.

@scottnonnenberg-signal yes! after yarn grunt then yarn test perfectly works!
Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bcsga picture bcsga  路  3Comments

cmdrogogov picture cmdrogogov  路  3Comments

ProactiveServices picture ProactiveServices  路  3Comments

lokesh-krishna picture lokesh-krishna  路  3Comments

hanzei picture hanzei  路  3Comments