Skip to content

Commit 5ea81d7

Browse files
committed
Add tests
1 parent 2778e84 commit 5ea81d7

10 files changed

+184
-0
lines changed

tests/baselines/reference/tsconfigExtendsJsoncPackage.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
===================================================================
2+
JsFile: index.js
3+
mapUrl: data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBYSxRQUFBLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
4+
sourceRoot:
5+
sources: index.ts
6+
===================================================================
7+
-------------------------------------------------------------------
8+
emittedFile:/index.js
9+
sourceFile:index.ts
10+
-------------------------------------------------------------------
11+
>>>"use strict";
12+
>>>Object.defineProperty(exports, "__esModule", { value: true });
13+
>>>exports.x = void 0;
14+
>>>exports.x = 42;
15+
1 >
16+
2 >^^^^^^^^
17+
3 > ^
18+
4 > ^^^
19+
5 > ^^
20+
6 > ^
21+
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
22+
1 >export const
23+
2 >
24+
3 > x
25+
4 > =
26+
5 > 42
27+
6 > ;
28+
1 >Emitted(4, 1) Source(1, 14) + SourceIndex(0)
29+
2 >Emitted(4, 9) Source(1, 14) + SourceIndex(0)
30+
3 >Emitted(4, 10) Source(1, 15) + SourceIndex(0)
31+
4 >Emitted(4, 13) Source(1, 18) + SourceIndex(0)
32+
5 >Emitted(4, 15) Source(1, 20) + SourceIndex(0)
33+
6 >Emitted(4, 16) Source(1, 21) + SourceIndex(0)
34+
---
35+
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBYSxRQUFBLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [tests/cases/compiler/tsconfigExtendsJsoncPackage.ts] ////
2+
3+
=== /index.ts ===
4+
export const x = 42;
5+
>x : Symbol(x, Decl(index.ts, 0, 12))
6+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [tests/cases/compiler/tsconfigExtendsJsoncPackage.ts] ////
2+
3+
=== /index.ts ===
4+
export const x = 42;
5+
>x : 42
6+
> : ^^
7+
>42 : 42
8+
> : ^^
9+

tests/baselines/reference/tsconfigExtendsJsoncRelative.js

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
===================================================================
2+
JsFile: index.js
3+
mapUrl: data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBYSxRQUFBLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
4+
sourceRoot:
5+
sources: index.ts
6+
===================================================================
7+
-------------------------------------------------------------------
8+
emittedFile:/index.js
9+
sourceFile:index.ts
10+
-------------------------------------------------------------------
11+
>>>"use strict";
12+
>>>Object.defineProperty(exports, "__esModule", { value: true });
13+
>>>exports.x = void 0;
14+
>>>exports.x = 42;
15+
1 >
16+
2 >^^^^^^^^
17+
3 > ^
18+
4 > ^^^
19+
5 > ^^
20+
6 > ^
21+
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
22+
1 >export const
23+
2 >
24+
3 > x
25+
4 > =
26+
5 > 42
27+
6 > ;
28+
1 >Emitted(4, 1) Source(1, 14) + SourceIndex(0)
29+
2 >Emitted(4, 9) Source(1, 14) + SourceIndex(0)
30+
3 >Emitted(4, 10) Source(1, 15) + SourceIndex(0)
31+
4 >Emitted(4, 13) Source(1, 18) + SourceIndex(0)
32+
5 >Emitted(4, 15) Source(1, 20) + SourceIndex(0)
33+
6 >Emitted(4, 16) Source(1, 21) + SourceIndex(0)
34+
---
35+
>>>//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBYSxRQUFBLENBQUMsR0FBRyxFQUFFLENBQUMifQ==
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [tests/cases/compiler/tsconfigExtendsJsoncRelative.ts] ////
2+
3+
=== /index.ts ===
4+
export const x = 42;
5+
>x : Symbol(x, Decl(index.ts, 0, 12))
6+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [tests/cases/compiler/tsconfigExtendsJsoncRelative.ts] ////
2+
3+
=== /index.ts ===
4+
export const x = 42;
5+
>x : 42
6+
> : ^^
7+
>42 : 42
8+
> : ^^
9+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Test case related to GitHub issue #43121: tsconfig should support extends with suffix `.jsonc`
2+
// This test case is to ensure an `extends` pointing to a package with a jsonc file works
3+
4+
// @filename: /node_modules/test-config/base.jsonc
5+
{
6+
"compilerOptions": {
7+
"inlineSourceMap": true
8+
}
9+
}
10+
11+
// @filename: /node_modules/test-config/package.json
12+
{
13+
"name": "test-config",
14+
"version": "1.0.0"
15+
}
16+
17+
// @filename: /tsconfig.json
18+
{
19+
"extends": "test-config/base.jsonc"
20+
}
21+
22+
// @filename: /index.ts
23+
export const x = 42;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Test case related to GitHub issue #43121: tsconfig should support extends with suffix `.jsonc`
2+
// Relative extends paths were passing before the issue: this test is to prevent regressions
3+
4+
// @filename: /configs/base.jsonc
5+
{
6+
"compilerOptions": {
7+
"inlineSourceMap": true
8+
}
9+
}
10+
11+
// @filename: /tsconfig.json
12+
{
13+
"extends": "./configs/base.jsonc"
14+
}
15+
16+
// @filename: /index.ts
17+
export const x = 42;

0 commit comments

Comments
 (0)