Skip to content

Commit

Permalink
refactor(compiler): use TypeScript LanguageService instead of `Prog…
Browse files Browse the repository at this point in the history
…ram` (#800)
  • Loading branch information
ahnpnl authored Feb 12, 2021
1 parent 16f835e commit a9ad3ef
Show file tree
Hide file tree
Showing 22 changed files with 207 additions and 938 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"jest-environment-jsdom": "27.0.0-next.1",
"pretty-format": "27.0.0-next.1",
"ts-jest": "^27.0.0-next.5"
"ts-jest": "^27.0.0-next.6"
},
"peerDependencies": {
"@angular-devkit/build-angular": ">=0.901.12",
Expand Down
9 changes: 0 additions & 9 deletions src/__tests__/__mocks__/foo.component.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/__tests__/__mocks__/foo.service.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/__tests__/__mocks__/foo.spec.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/__tests__/__mocks__/foo.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/__tests__/__mocks__/forward-ref.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/__tests__/__snapshots__/downlevel-ctor.spec.ts.snap

This file was deleted.

21 changes: 0 additions & 21 deletions src/__tests__/__snapshots__/hoisting.spec.ts.snap

This file was deleted.

94 changes: 33 additions & 61 deletions src/__tests__/__snapshots__/ng-jest-compiler.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,69 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NgJestCompiler with isolatedModule false should compile codes with useESM true 1`] = `
"import { __decorate } from \\"tslib\\";
import __NG_CLI_RESOURCE__0 from \\"./app.component.html\\";
import { Component } from '@angular/core';
let AppComponent = class AppComponent {
constructor() {
this.title = 'test-app-v10';
}
};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: __NG_CLI_RESOURCE__0,
styles: []
})
], AppComponent);
export { AppComponent };
//# "
exports[`NgJestCompiler with isolatedModules false should transform codes with useESM false using hoisting, replace resources and downlevel ctor transformers 1`] = `
Object {
"before": Array [
[Function],
[Function],
[Function],
],
}
`;

exports[`NgJestCompiler with isolatedModule false should compile new code when file changes: from hasErrorFileContent 1`] = `
"\\"use strict\\";
Object.defineProperty(exports, \\"__esModule\\", { value: true });
exports.AppComponent = void 0;
const tslib_1 = require(\\"tslib\\");
const core_1 = require(\\"@angular/core\\");
let = class {
constructor() {
this. = ;
}
};
= tslib_1.__decorate([
core_1.Component({
selector: 'app-root',
template: require(\\"./app.component.html\\"),
styles: []
})
], );
exports.AppComponent = ;
//# "
exports[`NgJestCompiler with isolatedModules false should transform codes with useESM true using hoisting, replace resources and downlevel ctor transformers 1`] = `
Object {
"before": Array [
[Function],
[Function],
[Function],
],
}
`;

exports[`NgJestCompiler with isolatedModule false should compile new code when file changes: from noErrorFileContent 1`] = `
"\\"use strict\\";
Object.defineProperty(exports, \\"__esModule\\", { value: true });
exports.AppComponent = void 0;
const tslib_1 = require(\\"tslib\\");
const core_1 = require(\\"@angular/core\\");
let AppComponent = class AppComponent {
constructor() {
this.title = 'test-app-v10';
}
};
AppComponent = tslib_1.__decorate([
core_1.Component({
selector: 'app-root',
template: require(\\"./app.component.html\\"),
styles: []
})
], AppComponent);
exports.AppComponent = AppComponent;
//# "
exports[`NgJestCompiler with isolatedModules true should transform codes with useESM false using hoisting, replace resources and downlevel ctor transformers 1`] = `
Object {
"before": Array [
[Function],
[Function],
[Function],
],
}
`;

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'."`;

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'."`;
exports[`NgJestCompiler with isolatedModules true should transform codes with useESM true using hoisting, replace resources and downlevel ctor transformers 1`] = `
Object {
"before": Array [
[Function],
[Function],
[Function],
],
}
`;
85 changes: 0 additions & 85 deletions src/__tests__/__snapshots__/replace-resources.spec.ts.snap

This file was deleted.

38 changes: 0 additions & 38 deletions src/__tests__/downlevel-ctor.spec.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/__tests__/hoisting.spec.ts

This file was deleted.

Loading

0 comments on commit a9ad3ef

Please sign in to comment.