Skip to content

Commit

Permalink
fix(testing): preserve the old coverage layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Dec 11, 2022

Verified

This commit was signed with the committer’s verified signature.
jorenham Joren Hammudoglu
1 parent 40b39b2 commit 34d861d
Showing 21 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/shared/angular-standalone-tutorial/3-task-running.md
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ Here's the `project.json` file for your `shared-ui` project:
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "shared/ui/jest.config.ts",
"passWithNoTests": true
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ Here are the outputs defined for the `shared-ui` project:
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "shared/ui/jest.config.ts",
"passWithNoTests": true
2 changes: 1 addition & 1 deletion docs/shared/angular-tutorial/3-task-running.md
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ Here's the `project.json` file for your `common-ui` project:
"targets": {
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/common-ui/jest.config.ts",
"passWithNoTests": true
2 changes: 1 addition & 1 deletion docs/shared/angular-tutorial/4-workspace-optimization.md
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ Outputs are defined for every target in your workspace:
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/products/jest.config.ts",
"passWithNoTests": true
2 changes: 1 addition & 1 deletion docs/shared/mental-model/large-tasks.json
Original file line number Diff line number Diff line change
@@ -14215,7 +14215,7 @@
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "graph/ui-graph/jest.config.ts",
"passWithNoTests": true
2 changes: 1 addition & 1 deletion e2e/nx-run/src/affected-graph.test.ts
Original file line number Diff line number Diff line change
@@ -331,7 +331,7 @@ describe('Nx Affected and Graph Tests', () => {
target: 'test',
},
command: `${runNx} run ${myapp}:test`,
outputs: [`coverage/${myapp}`],
outputs: [`coverage/apps/${myapp}`],
});
compareTwoArrays(resWithTarget.projects, [myapp]);

2 changes: 1 addition & 1 deletion graph/ui-graph/project.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "graph/ui-graph/jest.config.ts",
"passWithNoTests": true
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ Object {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
},
},
@@ -385,7 +385,7 @@ Object {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
},
},
Original file line number Diff line number Diff line change
@@ -222,7 +222,7 @@ Object {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
},
},
@@ -393,7 +393,7 @@ Object {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
},
},
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ Object {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
}
`;
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ describe('jestProject', () => {
const lib1 = readProjectConfiguration(tree, 'lib1');
expect(lib1.targets.test).toEqual({
executor: '@nrwl/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectName}'],
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: 'libs/lib1/jest.config.ts',
passWithNoTests: true,
1 change: 0 additions & 1 deletion packages/jest/src/generators/jest-project/jest-project.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import { checkForTestTarget } from './lib/check-for-test-target';
import { createFiles } from './lib/create-files';
import { updateTsConfig } from './lib/update-tsconfig';
import { updateWorkspace } from './lib/update-workspace';
import { updateJestConfig } from './lib/update-jestconfig';
import { JestProjectSchema } from './schema';
import { formatFiles, Tree, convertNxGenerator } from '@nrwl/devkit';

Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@ export function updateWorkspace(tree: Tree, options: JestProjectSchema) {
projectConfig.targets.test = {
executor: '@nrwl/jest:jest',
outputs: [
joinPathFragments('{workspaceRoot}', 'coverage', '{projectName}'),
options.rootProject
? joinPathFragments('{workspaceRoot}', 'coverage', '{projectName}')
: joinPathFragments('{workspaceRoot}', 'coverage', '{projectRoot}'),
],
options: {
jestConfig: joinPathFragments(
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ describe('@nrwl/linter:workspace-rules-project', () => {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
},
},
2 changes: 1 addition & 1 deletion packages/nest/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ describe('lib', () => {
});
expect(workspaceJson.projects[libFileName].architect.test).toEqual({
builder: '@nrwl/jest:jest',
outputs: [`{workspaceRoot}/coverage/{projectName}`],
outputs: [`{workspaceRoot}/coverage/{projectRoot}`],
options: {
jestConfig: `libs/${libFileName}/jest.config.ts`,
passWithNoTests: true,
2 changes: 1 addition & 1 deletion packages/node/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ describe('lib', () => {
});
expect(workspaceJson.projects['my-lib'].architect.test).toEqual({
builder: '@nrwl/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectName}'],
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: 'libs/my-lib/jest.config.ts',
passWithNoTests: true,
2 changes: 1 addition & 1 deletion packages/nx-plugin/src/generators/plugin/plugin.spec.ts
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ describe('NxPlugin Plugin Generator', () => {
});
expect(project.targets.test).toEqual({
executor: '@nrwl/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectName}'],
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: 'libs/my-plugin/jest.config.ts',
passWithNoTests: true,
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ exports[`@nrwl/vite:configuration transform React app to use Vite should transfo
\\"test\\": {
\\"builder\\": \\"@nrwl/jest:jest\\",
\\"outputs\\": [
\\"{workspaceRoot}/coverage/{projectName}\\"
\\"{workspaceRoot}/coverage/{projectRoot}\\"
],
\\"options\\": {
\\"jestConfig\\": \\"apps/my-test-react-app/jest.config.ts\\",
@@ -148,7 +148,7 @@ exports[`@nrwl/vite:configuration transform Web app to use Vite should transform
\\"test\\": {
\\"builder\\": \\"@nrwl/jest:jest\\",
\\"outputs\\": [
\\"{workspaceRoot}/coverage/{projectName}\\"
\\"{workspaceRoot}/coverage/{projectRoot}\\"
],
\\"options\\": {
\\"jestConfig\\": \\"apps/my-test-web-app/jest.config.ts\\",
2 changes: 1 addition & 1 deletion packages/vite/src/generators/vitest/vitest.spec.ts
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ describe('vitest generator', () => {
"passWithNoTests": true,
},
"outputs": Array [
"{workspaceRoot}/coverage/{projectName}",
"{workspaceRoot}/coverage/{projectRoot}",
],
}
`);
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/my-test-react-app/jest.config.ts",
"passWithNoTests": true
2 changes: 1 addition & 1 deletion packages/vite/src/utils/test-files/web-project.config.json
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/my-test-web-app/jest.config.ts",
"passWithNoTests": true

0 comments on commit 34d861d

Please sign in to comment.