如何在gitlab问题上用mongodb解决开玩笑

发布于 2025-02-14 01:36:34 字数 990 浏览 0 评论 0原文

Jest-MongoDB(NPM Run测试)在本地工作良好,但在Gitlab-Ci上不起作用,它突然在工作中停止工作并显示以下错误。

文件:jest.config.js

const merge = require('merge');
const ts_preset = require('ts-jest/jest-preset');
const jest_mongodb = require('@shelf/jest-mongodb/jest-preset');

module.exports = merge.recursive(ts_preset, jest_mongodb, {
  globals: {
    test_url: `http://${process.env.HOST || '127.0.0.1'}:${
      process.env.PORT || 3000
    }`,
  },
  preset: '@shelf/jest-mongodb',
  setupFiles: ['dotenv/config'],
  testPathIgnorePatterns: ['<rootDir>/__tests__/helpers'],
});

log:

Error: Jest: Got error running 
globalSetup - /builds/elo/elo-api/node_modules/@shelf/jest-mongodb/setup.js, 
reason: Instance Exited before 
being ready and without throwing an error!

”在此处输入图像说明” 请你能帮我吗?

jest-mongodb (npm run test) work well on local but not work on gitlab-ci, it was working suddenly it stopped working and show the following error.

file: jest.config.js

const merge = require('merge');
const ts_preset = require('ts-jest/jest-preset');
const jest_mongodb = require('@shelf/jest-mongodb/jest-preset');

module.exports = merge.recursive(ts_preset, jest_mongodb, {
  globals: {
    test_url: `http://${process.env.HOST || '127.0.0.1'}:${
      process.env.PORT || 3000
    }`,
  },
  preset: '@shelf/jest-mongodb',
  setupFiles: ['dotenv/config'],
  testPathIgnorePatterns: ['<rootDir>/__tests__/helpers'],
});

Log:

Error: Jest: Got error running 
globalSetup - /builds/elo/elo-api/node_modules/@shelf/jest-mongodb/setup.js, 
reason: Instance Exited before 
being ready and without throwing an error!

enter image description here
Please can you help me ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文