Skip to content

Commit a9ad3ef

Browse files
authored
refactor(compiler): use TypeScript LanguageService instead of Program (#800)
1 parent 16f835e commit a9ad3ef

22 files changed

+207
-938
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"dependencies": {
3636
"jest-environment-jsdom": "27.0.0-next.1",
3737
"pretty-format": "27.0.0-next.1",
38-
"ts-jest": "^27.0.0-next.5"
38+
"ts-jest": "^27.0.0-next.6"
3939
},
4040
"peerDependencies": {
4141
"@angular-devkit/build-angular": ">=0.901.12",

src/__tests__/__mocks__/foo.component.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/__tests__/__mocks__/foo.service.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/__tests__/__mocks__/foo.spec.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/__tests__/__mocks__/foo.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/__tests__/__mocks__/forward-ref.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/__tests__/__snapshots__/downlevel-ctor.spec.ts.snap

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/__tests__/__snapshots__/hoisting.spec.ts.snap

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 33 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,41 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`NgJestCompiler with isolatedModule false should compile codes with useESM true 1`] = `
4-
"import { __decorate } from \\"tslib\\";
5-
import __NG_CLI_RESOURCE__0 from \\"./app.component.html\\";
6-
import { Component } from '@angular/core';
7-
let AppComponent = class AppComponent {
8-
constructor() {
9-
this.title = 'test-app-v10';
10-
}
11-
};
12-
AppComponent = __decorate([
13-
Component({
14-
selector: 'app-root',
15-
template: __NG_CLI_RESOURCE__0,
16-
styles: []
17-
})
18-
], AppComponent);
19-
export { AppComponent };
20-
//# "
3+
exports[`NgJestCompiler with isolatedModules false should transform codes with useESM false using hoisting, replace resources and downlevel ctor transformers 1`] = `
4+
Object {
5+
"before": Array [
6+
[Function],
7+
[Function],
8+
[Function],
9+
],
10+
}
2111
`;
2212

23-
exports[`NgJestCompiler with isolatedModule false should compile new code when file changes: from hasErrorFileContent 1`] = `
24-
"\\"use strict\\";
25-
Object.defineProperty(exports, \\"__esModule\\", { value: true });
26-
exports.AppComponent = void 0;
27-
const tslib_1 = require(\\"tslib\\");
28-
const core_1 = require(\\"@angular/core\\");
29-
let = class {
30-
constructor() {
31-
this. = ;
32-
}
33-
};
34-
= tslib_1.__decorate([
35-
core_1.Component({
36-
selector: 'app-root',
37-
template: require(\\"./app.component.html\\"),
38-
styles: []
39-
})
40-
], );
41-
exports.AppComponent = ;
42-
//# "
13+
exports[`NgJestCompiler with isolatedModules false should transform codes with useESM true using hoisting, replace resources and downlevel ctor transformers 1`] = `
14+
Object {
15+
"before": Array [
16+
[Function],
17+
[Function],
18+
[Function],
19+
],
20+
}
4321
`;
4422

45-
exports[`NgJestCompiler with isolatedModule false should compile new code when file changes: from noErrorFileContent 1`] = `
46-
"\\"use strict\\";
47-
Object.defineProperty(exports, \\"__esModule\\", { value: true });
48-
exports.AppComponent = void 0;
49-
const tslib_1 = require(\\"tslib\\");
50-
const core_1 = require(\\"@angular/core\\");
51-
let AppComponent = class AppComponent {
52-
constructor() {
53-
this.title = 'test-app-v10';
54-
}
55-
};
56-
AppComponent = tslib_1.__decorate([
57-
core_1.Component({
58-
selector: 'app-root',
59-
template: require(\\"./app.component.html\\"),
60-
styles: []
61-
})
62-
], AppComponent);
63-
exports.AppComponent = AppComponent;
64-
//# "
23+
exports[`NgJestCompiler with isolatedModules true should transform codes with useESM false using hoisting, replace resources and downlevel ctor transformers 1`] = `
24+
Object {
25+
"before": Array [
26+
[Function],
27+
[Function],
28+
[Function],
29+
],
30+
}
6531
`;
6632

67-
exports[`NgJestCompiler with isolatedModule false should throw diagnostics error for new file which is: known by Program 1`] = `"src/__tests__/__mocks__/foo.component.ts(8,3): error TS2322: Type 'string' is not assignable to type 'number'."`;
68-
69-
exports[`NgJestCompiler with isolatedModule false should throw diagnostics error for new file which is: not known by Program 1`] = `"src/__tests__/__mocks__/foo.component.ts(8,3): error TS2322: Type 'string' is not assignable to type 'number'."`;
33+
exports[`NgJestCompiler with isolatedModules true should transform codes with useESM true using hoisting, replace resources and downlevel ctor transformers 1`] = `
34+
Object {
35+
"before": Array [
36+
[Function],
37+
[Function],
38+
[Function],
39+
],
40+
}
41+
`;

src/__tests__/__snapshots__/replace-resources.spec.ts.snap

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)