dzcode-io / dzcode.io

Website & mobile app for Algerian open-source community
https://dzcode.io
MIT License
114 stars 41 forks source link

getEnv import error! #227

Closed mohsenuss91 closed 3 years ago

mohsenuss91 commented 3 years ago

Bug description Test fail because of getEnv import error in dzcode.io\frontend\src\common\utils\index.spec.ts:4

Environment OS: Windows 10 node version: v13.12.0

Expected behavior Test pass.

Error outputs Test suite failed to run

Jest encountered an unexpected token

This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

Here's what you can do:
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.        

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html

Details:

dzcode.io\frontend\src\common\utils\index.spec.ts:4
import { getEnv } from '.';
^^^^^^

SyntaxError: Cannot use import statement outside a module

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1295:14)`
ZibanPirate commented 3 years ago

Hi @mohsenuss91 thank you for reporting this bug, can you please provide more context on this,

i'm unable to reproduce this bug on my machine.

mohsenuss91 commented 3 years ago

Hi @mohsenuss91 thank you for reporting this bug, can you please provide more context on this,

  • OS? e.g. Window 7
  • Node version? node -v
  • did u run yarn on the root?
  • yarn lint:check passes on your machine?

i'm unable to reproduce this bug on my machine.

Bug description updated with OS and node version.

ZibanPirate commented 3 years ago

I'm unable to reproduce the bug on my windows 10 machine with node 14, all tests are passing. Can you please retry running these commands on the root folder of the project:

mohsenuss91 commented 3 years ago

I'm unable to reproduce the bug on my windows 10 machine with node 14, all tests are passing. Can you please retry running these commands on the root folder of the project:

  • yarn
  • yarn lint:check
  • yarn test

Tests pass successfully when I use: yarn test or npm tun test

I'm having these errors with VSCODE debugger!

ZibanPirate commented 3 years ago

Thank you for clarifying @mohsenuss91 , debugging is not yet supported, if you want this feature please open a Feature Request issue for it and we will address it in the next milestone, additionally, you can implement this feature yourself in PR if you'd like to.

Since tests are passing, I'm closing this issue.