This behavior has several possible explanations:
- Different language versions. Ensure you are using the same language version on your machine and on CircleCI.
- Different package versions. Explicitly specify package versions in your configuration file.
- Timezone troubles. Some testing frameworks may not have timezone-aware modules. If the machine does not have a set timezone, some tests may fail. See this question in the FAQ for more details.
- File ordering. Some filesystems maintain an ordered file structure for each directory. This means that all files are read in the same order during each run. However, the filesystems in our build containers are unordered. If your tests only pass when run in a certain order, they may fail on CircleCI.
- "Out of Memory" errors. If a process in your build container uses too much memory, Linux's OOM killer may end it.
- Differing startup times. Applications like Elasticsearch and PostgreSQL may take more time to start up on CircleCI. You can fix this by explicitly waiting for a service to be available before running tests.
- Unreliable services. If your tests rely on a third-party service, check that the service is actually running.