Skip to content

Commit

Permalink
fix(core): fix dep outputs hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Jul 26, 2023
1 parent 1dadb3d commit 460438e
Show file tree
Hide file tree
Showing 9 changed files with 640 additions and 331 deletions.
350 changes: 350 additions & 0 deletions packages/nx/src/hasher/__snapshots__/task-hasher.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,350 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TaskHasher dependentTasksOutputFiles should depend on dependent tasks output files 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"dist/libs/child/index.d.ts": "3244421341483603138",
"dist/libs/grandchild/index.d.ts": "3244421341483603138",
"parent:!{projectRoot}/**/*.spec.ts": "5565329748974231692",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "13050024388944273054",
}
`;

exports[`TaskHasher dependentTasksOutputFiles should work with dependent tasks with globs as outputs 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"dist/libs/child/index.d.ts": "3244421341483603138",
"dist/libs/grandchild/index.d.ts": "3244421341483603138",
"parent:!{projectRoot}/**/*.spec.ts": "5565329748974231692",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "13050024388944273054",
}
`;

exports[`TaskHasher hashTarget should hash entire subtree of dependencies 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"app:{projectRoot}/**/*": "3487729839153061713",
"target": "@nx/webpack:webpack",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "10939456376142768975",
}
`;

exports[`TaskHasher hashTarget should hash executor dependencies of @nx packages 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"app:{projectRoot}/**/*": "3487729839153061713",
"target": "@nx/webpack:webpack",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "16749739796062259876",
}
`;

exports[`TaskHasher hashTarget should use externalDependencies to override nx:run-commands 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"app:{projectRoot}/**/*": "6954787296030520675",
"env:undefined": "3244421341483603138",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "10722281392353641974",
}
`;

exports[`TaskHasher hashTarget should use externalDependencies with empty array to ignore all deps 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"app:{projectRoot}/**/*": "10888929985620786238",
"env:undefined": "3244421341483603138",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "9711139740831088556",
}
`;

exports[`TaskHasher should be able to handle multiple filesets per project 1`] = `
{
"details": {
"command": "13785966310271077209",
"implicitDeps": {},
"nodes": {
"child:!{projectRoot}/**/*.spec.ts": "13192523093445129776",
"env:MY_TEST_HASH_ENV": "17357374746554314488",
"parent:{projectRoot}/**/*": "1629399803746755886",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/global1": "3052102066027208710",
"{workspaceRoot}/global2": "8197394511443659629",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "12260754209046637944",
}
`;

exports[`TaskHasher should be able to include only a part of the base tsconfig 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"parent:{projectRoot}/**/*": "16516751231904189589",
"runtime:echo runtime123": "runtime123",
"runtime:echo runtime456": "runtime456",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "2948361542445522019",
}
`;

exports[`TaskHasher should create task hash 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"env:NONEXISTENTENV": "3244421341483603138",
"env:TESTENV": "6544740722075256274",
"parent:{projectRoot}/**/*": "631071291822994098",
"runtime:echo runtime123": "runtime123",
"runtime:echo runtime456": "runtime456",
"tagged:{projectRoot}/**/*": "17111161286736679711",
"target": "nx:run-commands",
"unrelated:{projectRoot}/**/*": "8969690012466582257",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "3344547189263615580",
}
`;

exports[`TaskHasher should hash multiple filesets of a project 1`] = `
{
"details": {
"command": "13785966310271077209",
"implicitDeps": {},
"nodes": {
"parent:{projectRoot}/**/*": "17414698243987989547",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "16502280644049848992",
}
`;

exports[`TaskHasher should hash multiple filesets of a project 2`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"parent:!{projectRoot}/**/*.spec.ts": "7424658468918726082",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "6969083987792918940",
}
`;

exports[`TaskHasher should hash non-default filesets 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"child:{projectRoot}/**/*": "10025338539010063012",
"parent:!{projectRoot}/**/*.spec.ts": "5593646567034593596",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "10748517083069163130",
}
`;

exports[`TaskHasher should hash npm project versions 1`] = `
{
"details": {
"command": "14389236043839781668",
"implicitDeps": {},
"nodes": {
"app:{projectRoot}/**/*": "6028445962839227139",
"npm:react": "4468841026152585217",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "4145517376831960669",
}
`;

exports[`TaskHasher should hash task where the project has dependencies 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"child:{projectRoot}/**/*": "17112515743513902619",
"parent:{projectRoot}/**/*": "8668996094612916300",
"target": "unknown",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "9463228934259887792",
}
`;

exports[`TaskHasher should hash tasks where the project graph has circular dependencies 1`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"child:{projectRoot}/**/*": "13387017594662756393",
"parent:{projectRoot}/**/*": "3042098164316823883",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "17851309464404299797",
}
`;

exports[`TaskHasher should hash tasks where the project graph has circular dependencies 2`] = `
{
"details": {
"command": "7833005669885463868",
"implicitDeps": {},
"nodes": {
"child:{projectRoot}/**/*": "13387017594662756393",
"parent:{projectRoot}/**/*": "3042098164316823883",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "4621307928388816676",
}
`;

exports[`TaskHasher should use targetDefaults from nx.json 1`] = `
{
"details": {
"command": "6958627266354933907",
"implicitDeps": {},
"nodes": {
"child:{projectRoot}/**/*": "9791796197297932260",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/global1": "3052102066027208710",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "1795731262495053190",
}
`;

exports[`TaskHasher should use targetDefaults from nx.json 2`] = `
{
"details": {
"command": "4062279404379299270",
"implicitDeps": {},
"nodes": {
"child:!{projectRoot}/**/*.spec.ts": "6347155939449237455",
"parent:!{projectRoot}/**/*.spec.ts": "8912386769891259211",
"target": "nx:run-commands",
"{workspaceRoot}/.gitignore": "3244421341483603138",
"{workspaceRoot}/.nxignore": "3244421341483603138",
"{workspaceRoot}/nx.json": "8942239360311677987",
},
"runtime": {},
},
"value": "16490883615640042532",
}
`;
Loading

0 comments on commit 460438e

Please sign in to comment.