I have an Angular project and when I run "ng test" locally everything works just fine, however in bitbucket pipelines I have this error.
ERROR in src/app/services/user-store/user.service.ts:7:22 - error TS2307: Cannot find module '../../models/user' or its corresponding type declarations. 7 import { User } from '../../models/user';
My tsconfig.base
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
}
}
My tsconfig.spec.json
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
I think is related with the "target" in my tsconfig.base, but i'm not sure, maybe something missing in my yaml?
bitbucket-pipelines.yml
pipelines:
default:
- step:
name: Build, Lint and Test
image: rastasheep/alpine-node-chromium:12-alpine
caches:
- node
deployment: test
script:
- npm install
- npm run test:ci
- npm run e2e:ci
- npm run build:prod
- pipe: atlassian/firebase-deploy:0.3.0
variables:
FIREBASE_TOKEN: '$FIREBASE_TOKEN_CI'
User.ts
import * as firebase from 'firebase';
export interface User{
uid: string;
name: string;
email: string;
}