-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(core): update e2e tests to read from
dep-graph --file
instead…
… of unstable cache file Signed-off-by: AgentEnder <craigorycoppola@gmail.com>
- Loading branch information
1 parent
992216d
commit 61db894
Showing
4 changed files
with
29 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import { readJson } from 'fs-extra'; | ||
import { readJson, remove } from 'fs-extra'; | ||
import { join } from 'path'; | ||
import { execSync } from 'child_process'; | ||
|
||
export async function readDependenciesFromNxCache( | ||
export async function readDependenciesFromNxDepGraph( | ||
workspaceRoot: string, | ||
project: string, | ||
) { | ||
const depGraphCachePath = join( | ||
workspaceRoot, | ||
'node_modules/.cache/nx/nxdeps.json', | ||
); | ||
const depGraphFile = join('tmp', 'dep-graph.json'); | ||
execSync(`npx nx dep-graph --file ${depGraphFile}`, { | ||
cwd: workspaceRoot, | ||
stdio: 'inherit', | ||
}); | ||
const absolutePath = join(workspaceRoot, depGraphFile); | ||
const { graph } = await readJson(absolutePath); | ||
await remove(absolutePath); | ||
|
||
const files: Array<{ file: string; deps: string[] }> = ( | ||
await readJson(depGraphCachePath) | ||
).nodes[project].data.files; | ||
return new Set(files.flatMap((x) => x.deps)); | ||
const deps: Array<{ source: string; target: string }> = | ||
graph.dependencies[project]; | ||
console.log('[E2E]: Found dependencies', deps); | ||
return new Set(deps.map((x) => x.target)); | ||
} |
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