mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-15 22:11:23 +00:00
Start implementing a test suite for the CLI
We have very few tests today so this starts to add the basics of a test suite which compiles Cargo projects on-the-fly which will hopefully help us bolster the amount of assertions we can make about the output.
This commit is contained in:
@ -67,6 +67,9 @@ pub struct Context<'a> {
|
||||
|
||||
/// All package.json dependencies we've learned about so far
|
||||
pub package_json_read: HashSet<&'a str>,
|
||||
|
||||
/// A map of the name of npm dependencies we've loaded so far to the path
|
||||
/// they're defined in as well as their version specification.
|
||||
pub npm_dependencies: HashMap<String, (&'a str, String)>,
|
||||
|
||||
pub anyref: wasm_bindgen_anyref_xform::Context,
|
||||
@ -2967,8 +2970,7 @@ impl<'a, 'b> SubContext<'a, 'b> {
|
||||
}
|
||||
if !self.cx.config.mode.nodejs() && !self.cx.config.mode.bundler() {
|
||||
bail!("NPM dependencies have been specified in `{}` but \
|
||||
this is only compatible with the default output of \
|
||||
`wasm-bindgen` or the `--nodejs` flag");
|
||||
this is only compatible with the `bundler` and `nodejs` targets");
|
||||
}
|
||||
let contents = fs::read_to_string(path).context(format!("failed to read `{}`", path))?;
|
||||
let json: serde_json::Value = serde_json::from_str(&contents)?;
|
||||
|
Reference in New Issue
Block a user