Skip to content

ci: switch to GH actions and npm #138

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

Merged
merged 2 commits into from
Sep 26, 2020
Merged
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
112 changes: 0 additions & 112 deletions .circleci/config.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ci

on: pull_request

jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v1
- name: use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: npm install
- name: build
run: npm run build --skip-nx-cache
- name: test
run: npm run test --ci --code-coverage
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release

on:
push:
branches:
- master

jobs:
release:
if: github.repository == 'testing-library/angular-testing-library'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v1
- name: use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: npm install
- name: build
run: npm run build --skip-nx-cache
- name: test
run: npm run test --ci --code-coverage
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
registry=http://registry.npmjs.org/
registry=http://registry.npmjs.org/
package-lock=false
6 changes: 3 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"options": {
"jestConfig": "apps/example-app/jest.config.js",
"tsConfig": "apps/example-app/tsconfig.spec.json",
"setupFile": "apps/example-app/setup-jest.ts"
"setupFile": "apps/example-app/test-setup.ts"
}
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@
"options": {
"jestConfig": "projects/testing-library/jest.config.js",
"tsConfig": "projects/testing-library/tsconfig.spec.json",
"setupFile": "projects/testing-library/setup-jest.ts"
"setupFile": "projects/testing-library/test-setup.ts"
}
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@
"options": {
"jestConfig": "projects/jest-utils/jest.config.js",
"tsConfig": "projects/jest-utils/tsconfig.spec.json",
"setupFile": "projects/jest-utils/setup-jest.ts"
"setupFile": "projects/jest-utils/test-setup.ts"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('is possible to fill in a form and verify error messages (with the help of

const nameControl = screen.getByLabelText(/name/i);
const scoreControl = screen.getByRole('spinbutton', { name: /score/i });
const colorControl = screen.getByRole('listbox', { name: /color/i });
const colorControl = screen.getByRole('combobox', { name: /color/i });
const errors = screen.getByRole('alert');

expect(errors).toContainElement(screen.queryByText('name is required'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('works with provideMockStore', async () => {
const store = TestBed.inject(MockStore);
store.dispatch = jest.fn();

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

expect(store.dispatch).toBeCalledWith({ type: '[Item List] send', item: 'Seven' });
});
2 changes: 1 addition & 1 deletion apps/example-app/app/examples/07-with-ngrx-mock-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const selectItems = createSelector(
selector: 'app-fixture',
template: `
<ul>
<li *ngFor="let item of items | async" (click)="send(item)" [attr.aria-label]="item">{{ item }}</li>
<li *ngFor="let item of items | async" (click)="send(item)">{{ item }}</li>
</ul>
`,
})
Expand Down
4 changes: 2 additions & 2 deletions apps/example-app/app/examples/13-scrolling.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { render, screen, waitForElementToBeRemoved } from '@testing-library/angular';

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

test('should scroll to load more items', async () => {
await render(CdkVirtualScrollOverviewExample, {
await render(CdkVirtualScrollOverviewExampleComponent, {
imports: [ScrollingModule],
});

Expand Down
4 changes: 2 additions & 2 deletions apps/example-app/app/examples/13-scrolling.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'cdk-virtual-scroll-overview-example',
selector: 'app-cdk-virtual-scroll-overview-example',
template: `
<cdk-virtual-scroll-viewport itemSize="50" class="example-viewport" data-testid="scroll-viewport">
<div *cdkVirtualFor="let item of items" class="example-item">{{ item }}</div>
Expand All @@ -22,6 +22,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CdkVirtualScrollOverviewExample {
export class CdkVirtualScrollOverviewExampleComponent {
items = Array.from({ length: 100 }).map((_, i) => `Item #${i}`);
}
File renamed without changes.
6 changes: 4 additions & 2 deletions apps/example-app/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"types": ["jest", "node"]
}
"types": ["node", "jest"]
},
"files": ["test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ module.exports = {
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "nx run-many --target=build --all",
"test": "yarn affected:test",
"test": "nx run-many --target=test --all",
"lint": "nx workspace-lint && ng lint",
"e2e": "ng e2e",
"affected:apps": "nx affected:apps",
Expand Down Expand Up @@ -34,7 +34,7 @@
"@nrwl/angular": "^10.0.0",
"@nrwl/nx-cloud": "^10.0.0",
"@phenomnomnominal/tsquery": "^4.1.0",
"@testing-library/dom": "^7.18.1",
"@testing-library/dom": "^7.24.1",
"@testing-library/user-event": "^12.0.11",
"core-js": "^3.6.5",
"rxjs": "^6.5.5",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion projects/jest-utils/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"experimentalDecorators": true,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"types": ["@types/jest"],
"types": ["jest"],
"lib": ["dom", "es2015"]
},
"angularCompilerOptions": {
Expand Down
6 changes: 4 additions & 2 deletions projects/jest-utils/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"types": ["jest", "node"]
}
"types": ["node", "jest"]
},
"files": ["test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
6 changes: 3 additions & 3 deletions projects/testing-library/tests/migration/4_0_0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Migration to version 4.0.0', () => {
async function setup() {
await render(
HomeComponent,
{componentProperties: {
value: 'foo',
count: 2
Expand All @@ -107,12 +107,12 @@ describe('Migration to version 4.0.0', () => {
process.chdir(getSystemPath(host.root));
await host.write(specPath, input).toPromise();

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

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

expect(actual).toBe(expected);
expect(actual.replace(/\s/g, '')).toBe(expected.replace(/\s/g, ''));
});
});
});
2 changes: 1 addition & 1 deletion projects/testing-library/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": false,
"types": ["@types/jest", "@types/node"],
"types": ["node", "jest"],
"lib": ["dom", "es2015", "es2018.promise"]
},
"angularCompilerOptions": {
Expand Down
6 changes: 4 additions & 2 deletions projects/testing-library/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"types": ["jest", "node"]
}
"types": ["node", "jest"]
},
"files": ["test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
Loading