Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): support base composite project #1379

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dist/
node_modules/
e2e/__cases__/
e2e/__workdir_synlink__/
e2e/__workdir_symlink__/
coverage/
docs/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jspm_packages
# tests specific
tests/simple-long-path/long-src-path
# is linked to the temp dir of the os
e2e/__workdir_synlink__
e2e/__workdir_symlink__
**/.ts-jest-e2e.json
.ts-jest-digest
# while refactoring...
Expand Down
3 changes: 0 additions & 3 deletions e2e/__cases__/composite/foo.spec.ts

This file was deleted.

8 changes: 8 additions & 0 deletions e2e/__cases__/composite/packages/my-app/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { main } from './main';

test('main', () => {
const mockLog = jest.spyOn(console, 'log').mockImplementation(() => {});

main();
expect(mockLog).toHaveBeenCalledTimes(1);
});
11 changes: 11 additions & 0 deletions e2e/__cases__/composite/packages/my-app/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { myLibraryFunction } from '../my-library'

export function main() {
const value = myLibraryFunction();

console.log(`You got foo: "${value.foo}" and bar: ${value.bar}`);
}

if (require.main === module) {
main();
}
5 changes: 5 additions & 0 deletions e2e/__cases__/composite/packages/my-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.json",
"references": [{ "path": "../my-library"}],
"include": ["./**/*"]
}
11 changes: 11 additions & 0 deletions e2e/__cases__/composite/packages/my-library/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { myLibraryFunction } from './';

test('myLibraryFunction', () => {
const result = myLibraryFunction();

expect(result).toHaveProperty('foo');
expect(typeof result.foo).toBe('string');

expect(result).toHaveProperty('bar');
expect(typeof result.bar).toBe('number');
});
11 changes: 11 additions & 0 deletions e2e/__cases__/composite/packages/my-library/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export type MyType = {
foo: string;
bar: number;
};

export function myLibraryFunction(): MyType {
return {
foo: 'Hello!',
bar: 42
};
}
9 changes: 9 additions & 0 deletions e2e/__cases__/composite/packages/my-library/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": true,
"sourceMap": true,
"composite": true
},
"include": ["./**/*"]
}
14 changes: 12 additions & 2 deletions e2e/__cases__/composite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": ".tsbuildinfo"
"target": "es2018",
"module": "commonjs",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"lib": [
"dom", "es2018"
]
}
}
1 change: 1 addition & 0 deletions e2e/__helpers__/templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum PackageSets {
composite = 'composite',
default = 'default',
babel7 = 'with-babel-7',
babel7StringConfig = 'with-babel-7-string-config',
Expand Down
5 changes: 5 additions & 0 deletions e2e/__templates__/composite/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
projects: [
'<rootDir>/packages/*',
],
}
Loading