Commit 4d4637fd authored by Luke Sandberg's avatar Luke Sandberg

repro the libsql issue

parent e0c65232
...@@ -1826,7 +1826,7 @@ async fn process_parse_result( ...@@ -1826,7 +1826,7 @@ async fn process_parse_result(
} }
ParseResult::NotFound => { ParseResult::NotFound => {
let path = ident.path().to_string().await?; let path = ident.path().to_string().await?;
let msg = format!("Could not parse module '{path}'"); let msg = format!("Could not parse module '{path}', file not found");
let body = vec![ let body = vec![
quote!( quote!(
"const e = new Error($msg);" as Stmt, "const e = new Error($msg);" as Stmt,
......
...@@ -102,8 +102,12 @@ fn register() { ...@@ -102,8 +102,12 @@ fn register() {
// //
// "Skip" directories named `__skipped__`, which include test directories to // "Skip" directories named `__skipped__`, which include test directories to
// skip. // skip.
#[testing::fixture("tests/execution/*/*/*", exclude("node_modules|__skipped__"))] #[testing::fixture(
"tests/execution/**/input/index.js",
exclude("node_modules|__skipped__")
)]
fn test(resource: PathBuf) { fn test(resource: PathBuf) {
let resource = resource.parent().unwrap().parent().unwrap().to_path_buf();
let messages = get_messages(run(resource, IssueSnapshotMode::Snapshots).unwrap()); let messages = get_messages(run(resource, IssueSnapshotMode::Snapshots).unwrap());
if !messages.is_empty() { if !messages.is_empty() {
panic!( panic!(
...@@ -113,10 +117,10 @@ fn test(resource: PathBuf) { ...@@ -113,10 +117,10 @@ fn test(resource: PathBuf) {
} }
} }
#[testing::fixture("tests/execution/*/*/__skipped__/*/input")] #[testing::fixture("tests/execution/*/*/__skipped__/*/input/index.js")]
#[should_panic] #[should_panic]
fn test_skipped_fails(resource: PathBuf) { fn test_skipped_fails(resource: PathBuf) {
let resource = resource.parent().unwrap().to_path_buf(); let resource = resource.parent().unwrap().parent().unwrap().to_path_buf();
let JsResult { let JsResult {
// Ignore uncaught exceptions for skipped tests. // Ignore uncaught exceptions for skipped tests.
......
...@@ -168,9 +168,10 @@ fn is_empty_dir_tree(dir_entries: impl IntoIterator<Item = io::Result<fs::DirEnt ...@@ -168,9 +168,10 @@ fn is_empty_dir_tree(dir_entries: impl IntoIterator<Item = io::Result<fs::DirEnt
true true
} }
#[testing::fixture("tests/snapshot/*/*/", exclude("node_modules"))] #[testing::fixture("tests/snapshot/*/input/index.js", exclude("node_modules"))]
fn test(resource: PathBuf) { fn test(resource: PathBuf) {
let resource = canonicalize(resource).unwrap(); let resource = canonicalize(resource).unwrap();
let resource = resource.parent().unwrap().parent().unwrap().to_path_buf();
let mut has_output_dir = false; let mut has_output_dir = false;
let contents = fs::read_dir(&resource) let contents = fs::read_dir(&resource)
......
This was a triumph
I'm making a note here, "Great Success"
function get(name) {
return require(`./deps/${name}`)
}
console.log(get('cake').cake)
error - [analysis] /turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README:1:5 Parsing ecmascript source code failed
+ v-v
1 + This was a triumph
+ ^-^
2 | I'm making a note here, "Great Success"
3 |
Expected ';', '}' or <eof>
Import trace:
test:
./turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README
./turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/index.js
\ No newline at end of file
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([
"output/ba425_crates_turbopack-tests_tests_snapshot_dynamic-require_input_index_edad95b4.js",
{"otherChunks":["output/turbopack_crates_turbopack-tests_tests_snapshot_dynamic-require_input_4f7fc346._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/index.js [test] (ecmascript)"]}
]);
// Dummy runtime
\ No newline at end of file
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push(["output/turbopack_crates_turbopack-tests_tests_snapshot_dynamic-require_input_4f7fc346._.js",
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README [test] (ecmascript)", ((__turbopack_context__, module, exports) => {
const e = new Error("Could not parse module '[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README'\n\nExpected ';', '}' or <eof>");
e.code = 'MODULE_UNPARSABLE';
throw e;
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => {
exports.cake = "The cake is a like";
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/index.js [test] (ecmascript)", ((__turbopack_context__, module, exports) => {
function get(name) {
return __turbopack_context__.f({
"./deps/README": {
id: ()=>"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README [test] (ecmascript)",
module: ()=>__turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/README [test] (ecmascript)")
},
"./deps/cake": {
id: ()=>"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js [test] (ecmascript)",
module: ()=>__turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js [test] (ecmascript)")
},
"./deps/cake.js": {
id: ()=>"[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js [test] (ecmascript)",
module: ()=>__turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js [test] (ecmascript)")
}
})(`./deps/${name}`);
}
console.log(get('cake').cake);
}),
]);
//# sourceMappingURL=turbopack_crates_turbopack-tests_tests_snapshot_dynamic-require_input_4f7fc346._.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 9, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/deps/cake.js"],"sourcesContent":["exports.cake = \"The cake is a like\""],"names":[],"mappings":"AAAA,QAAQ,IAAI,GAAG"}},
{"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/dynamic-require/input/index.js"],"sourcesContent":["function get(name) {\n return require(`./deps/${name}`)\n}\n\nconsole.log(get('cake').cake)\n"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI;IACf;;;;;;;;;;;;;OAAe,CAAC,OAAO,EAAE,MAAM;AACjC;AAEA,QAAQ,GAAG,CAAC,IAAI,QAAQ,IAAI"}}]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment