-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from alexfriesen/jest-setup
✨ add jest
- Loading branch information
Showing
40 changed files
with
3,609 additions
and
2,550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Config } from 'jest'; | ||
import { pathsToModuleNameMapper } from 'ts-jest'; | ||
import { compilerOptions } from './tsconfig.json'; | ||
|
||
const config: Config = { | ||
clearMocks: true, | ||
collectCoverage: true, | ||
coverageProvider: 'v8', | ||
preset: 'jest-preset-angular', | ||
testEnvironment: 'jsdom', | ||
|
||
projects: ['<rootDir>/projects/*'], | ||
|
||
roots: ['<rootDir>'], | ||
modulePaths: ['<rootDir>/../..'], | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), | ||
transform: { | ||
'^.+\\.(ts|mjs|js|html)$': [ | ||
'jest-preset-angular', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
stringifyContentPathRegex: '\\.(html|svg)$', | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { Config } from 'jest'; | ||
import baseConfig from '../../jest.config'; | ||
|
||
const config: Config = { | ||
...baseConfig, | ||
displayName: 'demo', | ||
roots: ['<rootDir>'], | ||
coverageDirectory: '<rootDir>/../../coverage/demo', | ||
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'], | ||
}; | ||
|
||
export default config; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
projects/demo/src/app/components/demo/demo.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { DemoComponent } from './demo.component'; | ||
import { MatNativeDateModule, NativeDateModule } from '@angular/material/core'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
describe('DemoComponent', () => { | ||
let component: DemoComponent; | ||
let fixture: ComponentFixture<DemoComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
NoopAnimationsModule, | ||
NativeDateModule, | ||
MatNativeDateModule, | ||
|
||
DemoComponent, | ||
], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DemoComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'jest-preset-angular/setup-jest'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Config } from 'jest'; | ||
import baseConfig from '../../jest.config'; | ||
|
||
const config: Config = { | ||
...baseConfig, | ||
displayName: 'ngx-mat-timepicker', | ||
coverageDirectory: '<rootDir>/../../coverage/ngx-mat-timepicker', | ||
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'], | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.