forked from nrwl/nx
-
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.
refactor(testing): separate jest to @nrwl/jest
- Loading branch information
1 parent
9ee487d
commit 625b283
Showing
49 changed files
with
315 additions
and
206 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
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
docs/api-schematics/jest.md → docs/api-jest/schematics/ng-add.md
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# jest [hidden] | ||
# ng-add [hidden] | ||
|
||
Add Jest configuration to the workspace | ||
|
||
## Usage | ||
|
||
```bash | ||
ng generate jest ... | ||
ng generate ng-add ... | ||
|
||
``` |
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 |
---|---|---|
@@ -1,39 +1,23 @@ | ||
import { | ||
newProject, | ||
runCLI, | ||
newLib, | ||
runCLIAsync, | ||
newApp, | ||
copyMissingPackages, | ||
ensureProject, | ||
uniq | ||
} from '../utils'; | ||
import { newLib, runCLIAsync, newApp, ensureProject, uniq } from '../utils'; | ||
|
||
describe('Jest', () => { | ||
it('should be able to generate a testable library using jest', async done => { | ||
it('should be able test projects using jest', async done => { | ||
ensureProject(); | ||
const mylib = uniq('mylib'); | ||
const myapp = uniq('myapp'); | ||
newApp(`${myapp} --unit-test-runner jest --framework=angular`); | ||
newLib(`${mylib} --unit-test-runner jest --framework=angular`); | ||
|
||
await Promise.all([ | ||
runCLIAsync(`generate service test --project ${myapp}`), | ||
runCLIAsync(`generate component test --project ${myapp}`), | ||
runCLIAsync(`generate service test --project ${mylib}`), | ||
runCLIAsync(`generate component test --project ${mylib}`) | ||
]); | ||
const jestResult = await runCLIAsync(`test ${mylib}`); | ||
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total'); | ||
const appResult = await runCLIAsync(`test ${myapp}`); | ||
expect(appResult.stderr).toContain('Test Suites: 3 passed, 3 total'); | ||
const libResult = await runCLIAsync(`test ${mylib}`); | ||
expect(libResult.stderr).toContain('Test Suites: 3 passed, 3 total'); | ||
done(); | ||
}, 45000); | ||
|
||
it('should be able to generate a testable application using jest', async () => { | ||
ensureProject(); | ||
const myapp = uniq('myapp'); | ||
newApp(`${myapp} --unit-test-runner jest --framework=angular`); | ||
|
||
await Promise.all([ | ||
runCLIAsync(`generate service test --project ${myapp}`), | ||
runCLIAsync(`generate component test --project ${myapp}`) | ||
]); | ||
const jestResult = await runCLIAsync(`test ${myapp}`); | ||
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total'); | ||
}, 450000); | ||
}); |
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
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,10 @@ | ||
{ | ||
"$schema": "@angular-devkit/architect/src/builders-schema.json", | ||
"builders": { | ||
"jest": { | ||
"class": "./src/builders/jest/jest.builder", | ||
"schema": "./src/builders/jest/schema.json", | ||
"description": "Run Jest unit tests" | ||
} | ||
} | ||
} |
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,17 @@ | ||
{ | ||
"name": "Nx Jest", | ||
"version": "0.1", | ||
"schematics": { | ||
"ng-add": { | ||
"factory": "./src/schematics/ng-add/ng-add", | ||
"schema": "./src/schematics/ng-add/schema.json", | ||
"description": "Add Jest configuration to the workspace", | ||
"hidden": true | ||
}, | ||
"jest-project": { | ||
"factory": "./src/schematics/jest-project/jest-project", | ||
"schema": "./src/schematics/jest-project/schema.json", | ||
"description": "Add Jest configuration to a project" | ||
} | ||
} | ||
} |
Empty file.
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,3 @@ | ||
{ | ||
"schematics": {} | ||
} |
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,41 @@ | ||
{ | ||
"name": "@nrwl/jest", | ||
"version": "0.0.1", | ||
"description": "Jest plugin for Nx", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/nrwl/nx.git" | ||
}, | ||
"keywords": [ | ||
"Jest", | ||
"Unit Testing", | ||
"Workspace", | ||
"Monorepo", | ||
"Schematics", | ||
"Nx", | ||
"Angular CLI" | ||
], | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"author": "Victor Savkin", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/nrwl/nx/issues" | ||
}, | ||
"homepage": "https://nx.dev", | ||
"schematics": "./collection.json", | ||
"builders": "./builders.json", | ||
"ng-update": { | ||
"requirements": {}, | ||
"migrations": "./migrations.json" | ||
}, | ||
"peerDependencies": { | ||
"@nrwl/schematics": "*" | ||
}, | ||
"dependencies": { | ||
"@angular-devkit/architect": "~0.13.1", | ||
"@angular-devkit/core": "~7.3.1", | ||
"@angular-devkit/schematics": "~7.3.1", | ||
"rxjs": "6.3.3" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/builders/src/jest/schema.json → packages/jest/src/builders/jest/schema.json
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.