Hi
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 Command.run (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 https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
here is my main js file:
function isIDNumberValid(id_num) {
if (id_num.length < 13) {
return false;
}
return true;
}
console.log(isIDNumberValid("2001014800086"));
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", () => {
expect(isIDNumberValid("2001014800086")).toBe(true);
//expect(isIDNumberValid(2909035800085)).toBe(true);
});
});
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 (github.com)