Skip to content

Commit cb3ebad

Browse files
committed
Write new file text in baseline even if the file wasnt read on the shadow
1 parent 3af8421 commit cb3ebad

File tree

63 files changed

+4556
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4556
-197
lines changed

src/harness/vfsUtil.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ namespace vfs {
700700
* @param base The base file system. If not provided, this file system's `shadowRoot` is used (if present).
701701
*/
702702
public diff(base?: FileSystem | undefined, options: DiffOptions = {}) {
703+
debugger;
703704
if (!base && !options.baseIsNotShadowRoot) base = this.shadowRoot;
704705
const differences: FileSet = {};
705706
const hasDifferences = base ?
@@ -842,7 +843,7 @@ namespace vfs {
842843
container[basename] = new Symlink(node.symlink);
843844
}
844845
else {
845-
container[basename] = new File(node.buffer || "");
846+
container[basename] = new File(changed._getBuffer(node));
846847
}
847848
return true;
848849
}

tests/baselines/reference/tsbuild/clean/file-name-and-output-name-clashing.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517
//// [/src/bar.ts]
618

tests/baselines/reference/tsbuild/configFileErrors/when-tsconfig-extends-the-missing-file.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517
//// [/src/tsconfig.first.json]
618
{

tests/baselines/reference/tsbuild/configFileExtends/when-building-project-uses-reference-and-both-extend-config-with-include.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const a: Unrestricted = 1;
2727
type Unrestricted = any;
2828

2929
//// [/src/tsconfig.json]
30-
30+
{"references":[{"path":"./shared/tsconfig.json"},{"path":"./webpack/tsconfig.json"}],"files":[]}
3131

3232
//// [/src/webpack/index.ts]
3333
export const b: Unrestricted = 1;

tests/baselines/reference/tsbuild/declarationEmit/when-declaration-file-is-referenced-through-triple-slash-but-uses-no-references.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare const console: { log(msg: any): void; };
1919
export declare type Nominal<T, Name extends string> = MyNominal<T, Name>;
2020

2121
//// [/src/solution/src/common/tsconfig.json]
22-
22+
{"extends":"../../tsconfig.base.json","compilerOptions":{"composite":true},"include":["./nominal.ts"]}
2323

2424
//// [/src/solution/src/common/types.d.ts]
2525
declare type MyNominal<T, Name extends string> = T & {
@@ -31,7 +31,7 @@ import { Nominal } from '../common/nominal';
3131
export type MyNominal = Nominal<string, 'MyNominal'>;
3232

3333
//// [/src/solution/src/subProject/tsconfig.json]
34-
34+
{"extends":"../../tsconfig.base.json","compilerOptions":{"composite":true},"references":[{"path":"../common"}],"include":["./index.ts"]}
3535

3636
//// [/src/solution/src/subProject2/index.ts]
3737
import { MyNominal } from '../subProject/index';
@@ -43,10 +43,10 @@ export function getVar(): keyof typeof variable {
4343
}
4444

4545
//// [/src/solution/src/subProject2/tsconfig.json]
46-
46+
{"extends":"../../tsconfig.base.json","compilerOptions":{"composite":true},"references":[{"path":"../subProject"}],"include":["./index.ts"]}
4747

4848
//// [/src/solution/src/tsconfig.json]
49-
49+
{"compilerOptions":{"composite":true},"references":[{"path":"./subProject"},{"path":"./subProject2"}],"include":[]}
5050

5151
//// [/src/solution/tsconfig.base.json]
5252
{"compilerOptions":{"rootDir":"./","outDir":"lib"}}

tests/baselines/reference/tsbuild/demo/in-bad-ref-branch-reports-the-error-about-files-not-in-rootDir-at-the-import-location.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ export function lastElementOf<T>(arr: T[]): T | undefined {
132132
}
133133

134134
//// [/src/zoo/zoo.ts]
135+
import { Dog, createDog } from '../animals/index';
136+
137+
export function createZoo(): Array<Dog> {
138+
return [
139+
createDog()
140+
];
141+
}
142+
135143

136144

137145

tests/baselines/reference/tsbuild/demo/in-circular-branch-reports-the-error-about-it-by-stopping-build.js

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,53 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517
//// [/src/animals/animal.ts]
18+
export type Size = "small" | "medium" | "large";
19+
export default interface Animal {
20+
size: Size;
21+
}
622

723

824
//// [/src/animals/dog.ts]
25+
import Animal from '.';
26+
import { makeRandomName } from '../core/utilities';
27+
28+
export interface Dog extends Animal {
29+
woof(): void;
30+
name: string;
31+
}
32+
33+
export function createDog(): Dog {
34+
return ({
35+
size: "medium",
36+
woof: function(this: Dog) {
37+
console.log(`${this.name} says "Woof"!`);
38+
},
39+
name: makeRandomName()
40+
});
41+
}
42+
943

1044

1145
//// [/src/animals/index.ts]
46+
import Animal from './animal';
47+
48+
export default Animal;
49+
import { createDog, Dog } from './dog';
50+
export { createDog, Dog };
1251

1352

1453
//// [/src/animals/tsconfig.json]
@@ -40,6 +79,16 @@ Input::
4079

4180
//// [/src/core/utilities.ts]
4281

82+
export function makeRandomName() {
83+
return "Bob!?! ";
84+
}
85+
86+
export function lastElementOf<T>(arr: T[]): T | undefined {
87+
if (arr.length === 0) return undefined;
88+
return arr[arr.length - 1];
89+
}
90+
91+
4392

4493
//// [/src/tsconfig-base.json]
4594
{
@@ -87,6 +136,14 @@ Input::
87136
}
88137

89138
//// [/src/zoo/zoo.ts]
139+
import { Dog, createDog } from '../animals/index';
140+
141+
export function createZoo(): Array<Dog> {
142+
return [
143+
createDog()
144+
];
145+
}
146+
90147

91148

92149

tests/baselines/reference/tsbuild/emptyFiles/does-not-have-empty-files-diagnostic-when-files-is-empty-and-references-are-provided.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ export function multiply(a: number, b: number) { return a * b; }
3030

3131

3232
//// [/src/no-references/tsconfig.json]
33+
{
34+
"references": [],
35+
"files": [],
36+
"compilerOptions": {
37+
"composite": true,
38+
"declaration": true,
39+
"forceConsistentCasingInFileNames": true,
40+
"skipDefaultLibCheck": true
41+
}
42+
}
3343

3444

3545
//// [/src/with-references/tsconfig.json]

tests/baselines/reference/tsbuild/emptyFiles/has-empty-files-diagnostic-when-files-is-empty-and-no-references-are-provided.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517
//// [/src/core/index.ts]
18+
export function multiply(a: number, b: number) { return a * b; }
619

720

821
//// [/src/core/tsconfig.json]
22+
{
23+
"compilerOptions": {
24+
"composite": true,
25+
"declaration": true,
26+
"declarationMap": true,
27+
"skipDefaultLibCheck": true
28+
}
29+
}
930

1031

1132
//// [/src/no-references/tsconfig.json]
@@ -22,6 +43,18 @@ Input::
2243

2344

2445
//// [/src/with-references/tsconfig.json]
46+
{
47+
"references": [
48+
{ "path": "../core" },
49+
],
50+
"files": [],
51+
"compilerOptions": {
52+
"composite": true,
53+
"declaration": true,
54+
"forceConsistentCasingInFileNames": true,
55+
"skipDefaultLibCheck": true
56+
}
57+
}
2558

2659

2760

tests/baselines/reference/tsbuild/exitCodeOnBogusFile/test-exit-code.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517

618

tests/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Input::
22
//// [/lib/lib.d.ts]
3-
3+
/// <reference no-default-lib="true"/>
4+
interface Boolean {}
5+
interface Function {}
6+
interface CallableFunction {}
7+
interface NewableFunction {}
8+
interface IArguments {}
9+
interface Number { toExponential: any; }
10+
interface Object {}
11+
interface RegExp {}
12+
interface String { charAt: any; }
13+
interface Array<T> { length: number; [n: number]: T; }
14+
interface ReadonlyArray<T> {}
15+
declare const console: { log(msg: any): void; };
416

517
//// [/lib/lib.es2020.full.d.ts]
618
/// <reference no-default-lib="true"/>

tests/baselines/reference/tsbuild/outFile/builds-till-project-specified.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@ interface ReadonlyArray<T> {}
1515
declare const console: { log(msg: any): void; };
1616

1717
//// [/src/first/first_PART1.ts]
18+
interface TheFirst {
19+
none: any;
20+
}
21+
22+
const s = "Hello, world";
23+
24+
interface NoJsForHereEither {
25+
none: any;
26+
}
27+
28+
console.log(s);
1829

1930

2031
//// [/src/first/first_part2.ts]
32+
console.log(f());
2133

2234

2335
//// [/src/first/first_part3.ts]
24-
36+
function f() {
37+
return "JS does hoists";
38+
}
2539

2640
//// [/src/first/tsconfig.json]
2741
{
@@ -86,6 +100,8 @@ class C {
86100

87101

88102
//// [/src/third/third_part1.ts]
103+
var c = new C();
104+
c.doSomething();
89105

90106

91107
//// [/src/third/tsconfig.json]

0 commit comments

Comments
 (0)