All tests failed

Hi all,

After installation the application works properly, but tests not.
For example:
the command
npm test -t connection
generates output:
Error: Plugin/Preset files are not allowed to export objects, only functions. In D:\Courses\M220JS\mflix-js\node_modules\babel-preset-stage-1\lib\index.js
at createDescriptor (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-descriptors.js:178:11)
at (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-descriptors.js:109:50)
at ()
at createDescriptors (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-descriptors.js:101:10)
at presets (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-descriptors.js:47:19)
at mergeChainOpts (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-chain.js:320:26)
at D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-chain.js:283:7
at buildRootChain (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\config-chain.js:120:22)
at loadPrivatePartialConfig (D:\Courses\M220JS\mflix-js\node_modules@babel\core\lib\config\partial.js:85:55)
npm ERR! Test failed. See above for more details.



The same issue also with me.:disappointed:

Helped myself to google a bit and just remove .babelrc , but since i have issues one step later,it might NOT be the solution

The issue probably is in babel plugin,cause removing it will let you one step forward,but will break the understanding of import. I could’nt find the way around the issue fast enough

I also has same mistakes with tests…

Oh, I know… the reason is next: Babel updated to 7th version (installed for project), and babel-preset-stage-1 was deprecated. Project mflix worked good on Babel 6 (testing part)…

Thank you for quick response, unfortunately it is not my case.

Here is the devDependencies section from the package.json:
“babel-core”: “^6.26.3”,
“babel-eslint”: “^6.1.2”,
“babel-plugin-transform-runtime”: “^6.23.0”,
“babel-preset-env”: “^1.7.0”,
“babel-preset-stage-1”: “^6.24.1”,
“babel-register”: “^6.26.0”,
“babel-runtime”: “^6.26.0”

I am not good in Babel, I use Typescript in the last several years, so I still need help. And ofcouse I am continue to investigating the issue.

Finally I moved to Babel 7 how it is recommended by Lucka_49415 in the thread “Babel exception on all test”.

For this:

  1. Delete node_modules directory
  2. Delete package-lock.json file in the root directory
  3. Delete all Babel 6 devDependencies from the package.json file
  4. Add new Babel 7 to the devDependencies:
    @babel/core”: “^7.3.3”,
    @babel/plugin-transform-runtime”: “^7.2.0”,
    @babel/preset-env”: “^7.3.1”,
    @babel/register”: “^7.0.0”,
    @babel/runtime”: “^7.3.1”,
  5. Change .babelrc content to:
    “presets”: ["@babel/env"],
    “plugins”: ["@babel/transform-runtime"]
  6. run installation:
    npm i

The tests for Chapter1 passed OK:
npm test -t db-connection
npm test -t projection
npm test -t text-subfield

1 Like

Do not run “npm audit fix” and rebuild the project while keeping everything out of the box. It worked for me.

Hi @Stamatis_27661,

Please describe the issue here. So that we can help you out. :slight_smile:


1 Like