I'm trying to get started on running tests but I keep getting this error:
FAIL src/controler.test.ts Test suite failed to run
Cannot find module 'typescript'
Require stack
project\node_modules\ts-jest\dist\ts-jest-transformer.js
project\node_modules\ts-jest\dist\index.js
project\node_modules@jest\transform\build\ScriptTransformer.js
project\node_modules@jest\transform\build\index.js
project\node_modules\jest-runtime\build\index.js
project\node_modules@jest\core\build\cli\index.js
project\node_modules@jest\core\build\jest.js
project\node_modules\jest\node_modules\jest-cli\build\cli\index.js
project\node_modules\jest\node_modules\jest-cli\bin\jest.js
project\node_modules\jest\bin\jest.js\at Object. (node_modules/ts-jest/dist/config/config-set.js:58:20)\
I appreciate any help.
jest.config.js file:
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
coverageDirectory: "coverage",
testEnvironment: "node",
transform: {
'.+\\.ts$': 'ts-jest'
},
};
package.json file:
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/jest": "^26.0.22",
"@types/node": "^14.14.37",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"eslint": "^7.23.0",
"eslint-config-standard-with-typescript": "^20.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"git-commit-msg-linter": "^3.1.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"ts-jest": "^26.5.4",
"typecript": "0.0.1-security"
}
}
tsconfig.json file:
{
"compilerOptions": {
"outDir": "./dist",
"module": "commonjs",
"target": "ES2019",
"esModuleInterop": true,
"allowJs": true
}
}
npm i? - Logan Devine