Skip to content

Commit ba7f6e8

Browse files
committed
test(@angular-devkit/build-angular): add ng-packagr test application in build-angular
1 parent a0e2f28 commit ba7f6e8

File tree

17 files changed

+490
-0
lines changed

17 files changed

+490
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
testem.log
34+
/typings
35+
36+
# e2e
37+
/e2e/*.js
38+
/e2e/*.map
39+
40+
# System Files
41+
.DS_Store
42+
Thumbs.db
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "../../../../packages/angular_devkit/core/src/workspace/workspace-schema.json",
3+
"version": 1,
4+
"projects": {
5+
"lib": {
6+
"root": "projects/lib",
7+
"projectType": "library",
8+
"targets": {
9+
"build": {
10+
"builder": "@angular-devkit/build-angular:ng-packagr",
11+
"options": {
12+
"project": "projects/lib/ng-package.json",
13+
"tsConfig": "projects/lib/tsconfig.lib.json"
14+
},
15+
"configurations": {
16+
"production": {
17+
"tsConfig": "projects/lib/tsconfig.lib.prod.json"
18+
}
19+
}
20+
}
21+
}
22+
}
23+
}
24+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
// Karma configuration file, see link for more information
9+
// https://karma-runner.github.io/1.0/config/configuration-file.html
10+
11+
module.exports = function (config) {
12+
config.set({
13+
basePath: '',
14+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
15+
plugins: [
16+
require('karma-jasmine'),
17+
require('karma-chrome-launcher'),
18+
require('karma-jasmine-html-reporter'),
19+
require('karma-coverage-istanbul-reporter'),
20+
require('@angular-devkit/build-angular/plugins/karma')
21+
],
22+
client: {
23+
clearContext: false // leave Jasmine Spec Runner output visible in browser
24+
},
25+
coverageIstanbulReporter: {
26+
dir: require('path').join(__dirname, 'coverage'),
27+
reports: ['html', 'lcovonly'],
28+
fixWebpackSourcePaths: true
29+
},
30+
reporters: ['progress', 'kjhtml'],
31+
port: 9876,
32+
colors: true,
33+
logLevel: config.LOG_INFO,
34+
autoWatch: true,
35+
browsers: ['Chrome'],
36+
customLaunchers: {
37+
ChromeHeadlessCI: {
38+
base: 'ChromeHeadless',
39+
flags: ['--disable-gpu']
40+
}
41+
},
42+
singleRun: false
43+
});
44+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../../../../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/lib",
4+
"lib": {
5+
"entryFile": "src/public-api.ts"
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "lib",
3+
"version": "0.0.1",
4+
"peerDependencies": {
5+
"@angular/common": "^10.0.0",
6+
"@angular/core": "^10.0.0"
7+
}
8+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { ComponentFixture, TestBed } from '@angular/core/testing';
9+
10+
import { LibComponent } from './lib.component';
11+
12+
describe('LibComponent', () => {
13+
let component: LibComponent;
14+
let fixture: ComponentFixture<LibComponent>;
15+
16+
beforeEach(async () => {
17+
await TestBed.configureTestingModule({
18+
declarations: [ LibComponent ]
19+
})
20+
.compileComponents();
21+
});
22+
23+
beforeEach(() => {
24+
fixture = TestBed.createComponent(LibComponent);
25+
component = fixture.componentInstance;
26+
fixture.detectChanges();
27+
});
28+
29+
it('should create', () => {
30+
expect(component).toBeTruthy();
31+
});
32+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { Component, OnInit } from '@angular/core';
9+
10+
@Component({
11+
selector: 'lib',
12+
template: `
13+
<p>
14+
lib works!
15+
</p>
16+
`,
17+
styles: []
18+
})
19+
export class LibComponent implements OnInit {
20+
21+
constructor() { }
22+
23+
ngOnInit() {
24+
}
25+
26+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { NgModule } from '@angular/core';
9+
import { LibComponent } from './lib.component';
10+
import { LibService } from './lib.service';
11+
12+
@NgModule({
13+
imports: [
14+
],
15+
declarations: [LibComponent],
16+
providers: [LibService]
17+
})
18+
export class LibModule { }
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { TestBed, inject } from '@angular/core/testing';
9+
10+
import { LibService } from './lib.service';
11+
12+
describe('LibService', () => {
13+
beforeEach(() => {
14+
TestBed.configureTestingModule({
15+
providers: [LibService]
16+
});
17+
});
18+
19+
it('should be created', inject([LibService], (service: LibService) => {
20+
expect(service).toBeTruthy();
21+
}));
22+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { Injectable } from '@angular/core';
9+
10+
@Injectable()
11+
export class LibService {
12+
13+
constructor() { }
14+
15+
testEs2016() {
16+
return ['foo', 'bar'].includes('foo');
17+
}
18+
19+
}

0 commit comments

Comments
 (0)