Skip to content

Commit ea9d8a9

Browse files
committed
test(e2e): add additional e2e tests for package publishing
1 parent c887e1d commit ea9d8a9

3 files changed

Lines changed: 875 additions & 3 deletions

File tree

tests/e2e/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,40 @@ impl TestProject {
331331
)
332332
.expect("Failed to write index.js");
333333
}
334+
335+
#[allow(dead_code)]
336+
pub fn create_scoped_test_package(&self, scope: &str, name: &str, version: &str) {
337+
let full_name = format!("{}/{}", scope, name);
338+
339+
let package_json = serde_json::json!({
340+
"name": full_name,
341+
"version": version,
342+
"description": format!("Scoped test package {} for e2e tests", full_name),
343+
"main": "index.js",
344+
"scripts": {
345+
"test": "echo \"Error: no test specified\" && exit 1"
346+
},
347+
"keywords": ["test", "scoped"],
348+
"author": "test",
349+
"license": "MIT"
350+
});
351+
352+
fs::write(
353+
&self.package_json_path,
354+
serde_json::to_string_pretty(&package_json).unwrap(),
355+
)
356+
.expect("Failed to write scoped test package.json");
357+
358+
// Create a simple index.js
359+
fs::write(
360+
self.path().join("index.js"),
361+
format!(
362+
"module.exports = 'Hello from scoped package {}';",
363+
full_name
364+
),
365+
)
366+
.expect("Failed to write index.js");
367+
}
334368
}
335369

336370
/// Utility functions

0 commit comments

Comments
 (0)