Skip to content

Commit

Permalink
test: symbolicate js with invalid abs_path or lineno
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Jan 10, 2025
1 parent 12d1d5e commit 41144b1
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
source: crates/symbolicator-js/tests/integration/sourcemap.rs
assertion_line: 380
expression: response
---
stacktraces:
- frames:
- filename: test.js
lineno: 1
colno: 1
data:
symbolicated: false
raw_stacktraces:
- frames:
- filename: test.js
lineno: 1
colno: 1
data:
symbolicated: false
errors:
- abs_path: ""
type: invalid_abs_path
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
source: crates/symbolicator-js/tests/integration/sourcemap.rs
assertion_line: 397
expression: response
---
stacktraces:
- frames:
- filename: test.js
abs_path: http//example.com/test.min.js
data:
symbolicated: false
raw_stacktraces:
- frames:
- filename: test.js
abs_path: http//example.com/test.min.js
data:
symbolicated: false
errors:
- abs_path: http//example.com/test.min.js
type: invalid_location
line: 0
col: ~
34 changes: 34 additions & 0 deletions crates/symbolicator-js/tests/integration/sourcemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,40 @@ async fn test_malformed_abs_path() {
assert_snapshot!(response);
}

#[tokio::test]
async fn test_invalid_abs_path() {
let (symbolication, _cache_dir) = setup_service(|_| ());
let (_srv, source) = sourcemap_server("", |_url, _query| json!([]));

let frames = r#"[{
"filename": "test.js",
"lineno": 1,
"colno": 1
}]"#;

let request = make_js_request(source, frames, "[]", String::from("release"), None);
let response = symbolication.symbolicate_js(request).await;

assert_snapshot!(response);
}


#[tokio::test]
async fn test_invalid_lineno() {
let (symbolication, _cache_dir) = setup_service(|_| ());
let (_srv, source) = sourcemap_server("", |_url, _query| json!([]));

let frames = r#"[{
"abs_path": "http//example.com/test.min.js",
"filename": "test.js"
}]"#;

let request = make_js_request(source, frames, "[]", String::from("release"), None);
let response = symbolication.symbolicate_js(request).await;

assert_snapshot!(response);
}

#[tokio::test]
async fn test_fetch_error() {
let (symbolication, _cache_dir) = setup_service(|_| ());
Expand Down

0 comments on commit 41144b1

Please sign in to comment.