How to solve "npm ERR! Test failed. See above for more details."?

270 Views Asked by At

I am using javascript to write selenium test scripts. It was working in another system. So here is the error that is persistent on running the "npm test" command.

✖ ERROR: Error: Not supported
    at Object.exports.doImport (/home/sahil/frontend-selenium-testing/node_modules/mocha/lib/nodejs/esm-utils.js:35:41)
    at formattedImport (/home/sahil/frontend-selenium-testing/node_modules/mocha/lib/nodejs/esm-utils.js:32:18)
    at exports.requireOrImport (/home/sahil/frontend-selenium-testing/node_modules/mocha/lib/nodejs/esm-utils.js:42:34)
    at exports.handleRequires (/home/sahil/frontend-selenium-testing/node_modules/mocha/lib/cli/run-helpers.js:94:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! Test failed.  See above for more details.

And here is my package.json file

{
  "name": "selenium",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha --no-timeouts --reporter mochawesome --require mochawesome/register"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chai": "^4.3.7",
    "mocha": "^10.2.0",
    "mochawesome": "^7.1.3",
    "selenium-webdriver": "^4.7.1"
  }
}

This is how I am importing packages.

const { Builder, By, Key, until } = require("selenium-webdriver")
const assert = require('assert')
const should = require('chai').should()
const { monitorTaskTestFunc } = require('./monitorTask')
const { resolve } = require("path")
const { loginTest } = require("./loginTest")

I have used this link to setup path for chrome webdriver, setup chrome webdriver in ubuntu

0

There are 0 best solutions below