-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f86b92f
commit cef6e1a
Showing
23 changed files
with
293 additions
and
48 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 |
---|---|---|
|
@@ -21,7 +21,7 @@ fn test_double_symlink() -> Result<(), anyhow::Error> { | |
} | ||
|
||
#[test] | ||
fn test_trace() -> Result<(), anyhow::Error> { | ||
fn test_ast() -> Result<(), anyhow::Error> { | ||
// Separate because the `\\` -> `/` filter isn't compatible with ast | ||
check_json!( | ||
"turbo_trace", | ||
|
@@ -30,6 +30,11 @@ fn test_trace() -> Result<(), anyhow::Error> { | |
"get `main.ts` with ast" => "query { file(path: \"main.ts\") { path ast } }", | ||
); | ||
|
||
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn test_trace() -> Result<(), anyhow::Error> { | ||
insta::with_settings!({ filters => vec![(r"\\\\", "/")]}, { | ||
check_json!( | ||
"turbo_trace", | ||
|
@@ -41,8 +46,36 @@ fn test_trace() -> Result<(), anyhow::Error> { | |
"get `circular.ts` with dependencies" => "query { file(path: \"circular.ts\") { path dependencies { files { items { path } } } } }", | ||
"get `invalid.ts` with dependencies" => "query { file(path: \"invalid.ts\") { path dependencies { files { items { path } } errors { items { message } } } } }", | ||
"get `main.ts` with depth = 0" => "query { file(path: \"main.ts\") { path dependencies(depth: 1) { files { items { path } } } } }", | ||
"get `with_prefix.ts` with dependencies" => "query { file(path: \"with_prefix.ts\") { path dependencies { files { items { path } } } } }", | ||
); | ||
|
||
Ok(()) | ||
}) | ||
} | ||
|
||
#[test] | ||
fn test_trace_on_monorepo() -> Result<(), anyhow::Error> { | ||
insta::with_settings!({ filters => vec![(r"\\\\", "/")]}, { | ||
check_json!( | ||
"turbo_trace_monorepo", | ||
"[email protected]", | ||
"query", | ||
"get `apps/my-app/index.ts` with dependencies" => "query { file(path: \"apps/my-app/index.ts\") { path dependencies { files { items { path } } errors { items { message } } } } }", | ||
"get `packages/utils/index` with dependents" => "query { file(path: \"packages/utils/index.ts\") { path dependents { files { items { path } } errors { items { message } } } } }", | ||
); | ||
|
||
Ok(()) | ||
}) | ||
} | ||
|
||
#[test] | ||
fn test_reverse_trace() -> Result<(), anyhow::Error> { | ||
check_json!( | ||
"turbo_trace", | ||
"[email protected]", | ||
"query", | ||
"get `button.tsx` with dependents" => "query { file(path: \"button.tsx\") { path dependents { files { items { path } } } } }", | ||
); | ||
|
||
Ok(()) | ||
} |
23 changes: 23 additions & 0 deletions
23
...epo/tests/snapshots/query__turbo_trace_get_`button.tsx`_with_dependents_([email protected]).snap
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,23 @@ | ||
--- | ||
source: crates/turborepo/tests/query.rs | ||
expression: query_output | ||
--- | ||
{ | ||
"data": { | ||
"file": { | ||
"path": "button.tsx", | ||
"dependents": { | ||
"files": { | ||
"items": [ | ||
{ | ||
"path": "invalid.ts" | ||
}, | ||
{ | ||
"path": "main.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
23 changes: 23 additions & 0 deletions
23
...sts/snapshots/query__turbo_trace_get_`with_prefix.ts`_with_dependencies_([email protected]).snap
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,23 @@ | ||
--- | ||
source: crates/turborepo/tests/query.rs | ||
expression: query_output | ||
--- | ||
{ | ||
"data": { | ||
"file": { | ||
"path": "with_prefix.ts", | ||
"dependencies": { | ||
"files": { | ||
"items": [ | ||
{ | ||
"path": "bar.js" | ||
}, | ||
{ | ||
"path": "foo.js" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.