forked from serverless/serverless-plugin-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypescript.getTypescriptConfig.test.ts
More file actions
37 lines (34 loc) · 1.23 KB
/
typescript.getTypescriptConfig.test.ts
File metadata and controls
37 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {getTypescriptConfig, makeDefaultTypescriptConfig} from '../src/typescript'
describe('getTypescriptConfig', () => {
it(`returns default typescript configuration if the one provided doesn't exist`, () => {
expect(
getTypescriptConfig('/ciaone/my-folder'),
).toEqual(
makeDefaultTypescriptConfig()
)
})
it (`should throw an error if configured typescript configuration does not exist`, () => {
expect(() =>
getTypescriptConfig(process.cwd(), {
service: {
custom: {
typeScript: {
tsconfigFilePath: "./some-path"
}
}}
} as any),
).toThrowError("Custom Typescript Config File not found")
})
it (`returns configured typescript configuration if provided`, () => {
expect(
getTypescriptConfig(process.cwd(), {
service: {
custom: {
typeScript: {
tsconfigFilePath: "./tests/custom.tsconfig.json"
}
}}
} as any).target,
).toEqual(2)
})
})