Need help with node/jasmine error


When i enter npm test i get this node/jasmine error:

> jasmine

(node:7172) UnhandledPromiseRejectionWarning: Error: Not supported    at Loader.importShim [as import_] (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\loader.js:56:3)
    at Loader.load (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\loader.js:25:17)
    at Jasmine.loadSpecificConfigFile_ (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\jasmine.js:248:36)
    at Jasmine.loadConfigFile (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\jasmine.js:236:20)
    at async runJasmine (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\command.js:125:3)      
    at async (C:\Users\Gaziem\Desktop\coding\javascript\validateIDNumber\node_modules\jasmine\lib\command.js:56:9)      
(node:7172) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see (rejection id: 3)

here is my main js file:

function isIDNumberValid(id_num) {
	if (id_num.length < 13) {
		return false;
	return true;

module.exports = { isIDNumberValid };

here is my spec file:

const { isIDNumberValid } = require("../idNumber.js");

describe("Check if id number is valid", () => {
	it("Check if string is less than 13 length", () => {

here is my package.json file:

  "name": "validateidnumber",
  "version": "1.0.0",
  "description": "",
  "main": "idNumber.js",
  "scripts": {
    "test": "jasmine"
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.2"
  "devDependencies": {
    "jasmine": "^4.0.2"

Please help me fix the above error

github link: mraees93/test (

Hi @mraees93

It is difficult to tell why you are getting this particular error. Perhaps host the code on gitHub so that we can run it to see what is happening.

uploaded github link at the bottom of post

I was able to clone the project and run it on my machine without encountering any error. Check the screenshot below.

And when I set the test to fail deliberately, it still runs and fails as expected.


This is what I see on the terminal after running the test. You can see the test runs successfully.

I can only guess what the problem is. Probably the version of Node you are using is not supported. According to the documentation:

Jasmine 4.x supports Node versions 12.17+, 14, and 16. (Odd-numbered Node versions aren’t supported, but many of them work.)

Try changing the Node version if the one you are using is not among the supported ones and see what happens. Unfortunately doing that requires you to install Node Version Manager.

Or probably there is a dependency that is not working as expected. I cannot tell exactly. I don’t have a windows machine otherwise I would have run the project on windows. Probably clone the project to another directory like I did and do a fresh installation to see what comes out of it.

I hope that helps.

thanks soooo much, i installed node version 16.13

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.