Skip to content

Commit dc8cb33

Browse files
ci: switch to GH actions and npm (#138)
1 parent 077ecb5 commit dc8cb33

22 files changed

+97
-14132
lines changed

Diff for: .circleci/config.yml

-112
This file was deleted.

Diff for: .github/workflows/ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: ci
2+
3+
on: pull_request
4+
5+
jobs:
6+
build_and_test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node-version: [12.x]
11+
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: use Node.js ${{ matrix.node-version }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- name: install
19+
run: npm install
20+
- name: build
21+
run: npm run build --skip-nx-cache
22+
- name: test
23+
run: npm run test --ci --code-coverage

Diff for: .github/workflows/release.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
if: github.repository == 'testing-library/angular-testing-library'
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [12.x]
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
- name: use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: install
23+
run: npm install
24+
- name: build
25+
run: npm run build --skip-nx-cache
26+
- name: test
27+
run: npm run test --ci --code-coverage
28+
- name: Release
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
run: npx semantic-release

Diff for: .npmrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
registry=http://registry.npmjs.org/
1+
registry=http://registry.npmjs.org/
2+
package-lock=false

Diff for: angular.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"options": {
7979
"jestConfig": "apps/example-app/jest.config.js",
8080
"tsConfig": "apps/example-app/tsconfig.spec.json",
81-
"setupFile": "apps/example-app/setup-jest.ts"
81+
"setupFile": "apps/example-app/test-setup.ts"
8282
}
8383
}
8484
}
@@ -134,7 +134,7 @@
134134
"options": {
135135
"jestConfig": "projects/testing-library/jest.config.js",
136136
"tsConfig": "projects/testing-library/tsconfig.spec.json",
137-
"setupFile": "projects/testing-library/setup-jest.ts"
137+
"setupFile": "projects/testing-library/test-setup.ts"
138138
}
139139
}
140140
}
@@ -181,7 +181,7 @@
181181
"options": {
182182
"jestConfig": "projects/jest-utils/jest.config.js",
183183
"tsConfig": "projects/jest-utils/tsconfig.spec.json",
184-
"setupFile": "projects/jest-utils/setup-jest.ts"
184+
"setupFile": "projects/jest-utils/test-setup.ts"
185185
}
186186
}
187187
}

Diff for: apps/example-app/app/examples/04-forms-with-material.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('is possible to fill in a form and verify error messages (with the help of
1111

1212
const nameControl = screen.getByLabelText(/name/i);
1313
const scoreControl = screen.getByRole('spinbutton', { name: /score/i });
14-
const colorControl = screen.getByRole('listbox', { name: /color/i });
14+
const colorControl = screen.getByRole('combobox', { name: /color/i });
1515
const errors = screen.getByRole('alert');
1616

1717
expect(errors).toContainElement(screen.queryByText('name is required'));

Diff for: apps/example-app/app/examples/07-with-ngrx-mock-store.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test('works with provideMockStore', async () => {
2121
const store = TestBed.inject(MockStore);
2222
store.dispatch = jest.fn();
2323

24-
fireEvent.click(screen.getByRole('listitem', { name: /seven/i }));
24+
fireEvent.click(screen.getByText(/seven/i));
2525

2626
expect(store.dispatch).toBeCalledWith({ type: '[Item List] send', item: 'Seven' });
2727
});

Diff for: apps/example-app/app/examples/07-with-ngrx-mock-store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const selectItems = createSelector(
1010
selector: 'app-fixture',
1111
template: `
1212
<ul>
13-
<li *ngFor="let item of items | async" (click)="send(item)" [attr.aria-label]="item">{{ item }}</li>
13+
<li *ngFor="let item of items | async" (click)="send(item)">{{ item }}</li>
1414
</ul>
1515
`,
1616
})

Diff for: apps/example-app/app/examples/13-scrolling.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { render, screen, waitForElementToBeRemoved } from '@testing-library/angular';
22

3-
import { CdkVirtualScrollOverviewExample } from './13-scrolling.component';
3+
import { CdkVirtualScrollOverviewExampleComponent } from './13-scrolling.component';
44
import { ScrollingModule } from '@angular/cdk/scrolling';
55

66
test('should scroll to load more items', async () => {
7-
await render(CdkVirtualScrollOverviewExample, {
7+
await render(CdkVirtualScrollOverviewExampleComponent, {
88
imports: [ScrollingModule],
99
});
1010

Diff for: apps/example-app/app/examples/13-scrolling.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChangeDetectionStrategy, Component } from '@angular/core';
22

33
@Component({
4-
selector: 'cdk-virtual-scroll-overview-example',
4+
selector: 'app-cdk-virtual-scroll-overview-example',
55
template: `
66
<cdk-virtual-scroll-viewport itemSize="50" class="example-viewport" data-testid="scroll-viewport">
77
<div *cdkVirtualFor="let item of items" class="example-item">{{ item }}</div>
@@ -22,6 +22,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
2222
],
2323
changeDetection: ChangeDetectionStrategy.OnPush,
2424
})
25-
export class CdkVirtualScrollOverviewExample {
25+
export class CdkVirtualScrollOverviewExampleComponent {
2626
items = Array.from({ length: 100 }).map((_, i) => `Item #${i}`);
2727
}
File renamed without changes.

Diff for: apps/example-app/tsconfig.spec.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"types": ["jest", "node"]
6-
}
5+
"types": ["node", "jest"]
6+
},
7+
"files": ["test-setup.ts"],
8+
"include": ["**/*.spec.ts", "**/*.d.ts"]
79
}

Diff for: jest.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,20 @@ module.exports = {
66
resolver: '@nrwl/jest/plugins/resolver',
77
moduleFileExtensions: ['ts', 'js', 'html'],
88
coverageReporters: ['html'],
9+
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
910
snapshotSerializers: [
1011
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
1112
'jest-preset-angular/build/AngularSnapshotSerializer.js',
1213
'jest-preset-angular/build/HTMLCommentSerializer.js',
1314
],
15+
globals: {
16+
'ts-jest': {
17+
tsConfig: '<rootDir>/tsconfig.spec.json',
18+
stringifyContentPathRegex: '\\.(html|svg)$',
19+
astTransformers: [
20+
'jest-preset-angular/build/InlineFilesTransformer',
21+
'jest-preset-angular/build/StripStylesTransformer',
22+
],
23+
},
24+
},
1425
};

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"ng": "ng",
66
"start": "ng serve",
77
"build": "nx run-many --target=build --all",
8-
"test": "yarn affected:test",
8+
"test": "nx run-many --target=test --all",
99
"lint": "nx workspace-lint && ng lint",
1010
"e2e": "ng e2e",
1111
"affected:apps": "nx affected:apps",
@@ -34,7 +34,7 @@
3434
"@nrwl/angular": "^10.0.0",
3535
"@nrwl/nx-cloud": "^10.0.0",
3636
"@phenomnomnominal/tsquery": "^4.1.0",
37-
"@testing-library/dom": "^7.18.1",
37+
"@testing-library/dom": "^7.24.1",
3838
"@testing-library/user-event": "^12.0.11",
3939
"core-js": "^3.6.5",
4040
"rxjs": "^6.5.5",
File renamed without changes.

Diff for: projects/jest-utils/tsconfig.lib.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"experimentalDecorators": true,
1313
"importHelpers": true,
1414
"allowSyntheticDefaultImports": true,
15-
"types": ["@types/jest"],
15+
"types": ["jest"],
1616
"lib": ["dom", "es2015"]
1717
},
1818
"angularCompilerOptions": {

Diff for: projects/jest-utils/tsconfig.spec.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"types": ["jest", "node"]
6-
}
5+
"types": ["node", "jest"]
6+
},
7+
"files": ["test-setup.ts"],
8+
"include": ["**/*.spec.ts", "**/*.d.ts"]
79
}
File renamed without changes.

Diff for: projects/testing-library/tests/migration/4_0_0.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('Migration to version 4.0.0', () => {
8383
async function setup() {
8484
await render(
8585
HomeComponent,
86-
86+
8787
{componentProperties: {
8888
value: 'foo',
8989
count: 2
@@ -107,12 +107,12 @@ describe('Migration to version 4.0.0', () => {
107107
process.chdir(getSystemPath(host.root));
108108
await host.write(specPath, input).toPromise();
109109

110-
schematicRunner.runSchematic('migration-4.0.0', {}, tree);
110+
await schematicRunner.runSchematicAsync('migration-4.0.0', {}, tree).toPromise();
111111
await schematicRunner.engine.executePostTasks().toPromise();
112112

113113
const actual = await host.read(specPath).toPromise().then(virtualFs.fileBufferToString);
114114

115-
expect(actual).toBe(expected);
115+
expect(actual.replace(/\s/g, '')).toBe(expected.replace(/\s/g, ''));
116116
});
117117
});
118118
});

Diff for: projects/testing-library/tsconfig.lib.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"emitDecoratorMetadata": true,
1212
"experimentalDecorators": true,
1313
"importHelpers": false,
14-
"types": ["@types/jest", "@types/node"],
14+
"types": ["node", "jest"],
1515
"lib": ["dom", "es2015", "es2018.promise"]
1616
},
1717
"angularCompilerOptions": {

Diff for: projects/testing-library/tsconfig.spec.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"types": ["jest", "node"]
6-
}
5+
"types": ["node", "jest"]
6+
},
7+
"files": ["test-setup.ts"],
8+
"include": ["**/*.spec.ts", "**/*.d.ts"]
79
}

0 commit comments

Comments
 (0)