test: Add a failing test case for #242

master
Nick Fitzgerald 7 years ago
parent 883cae220c
commit e2e3e49f50
  1. 18
      tests/all/build.rs
  2. 2
      tests/all/main.rs
  3. 1
      tests/fixtures/not-a-crate/README.md

@ -0,0 +1,18 @@
use structopt::StructOpt;
use utils;
use wasm_pack::{command, logger, Cli};
#[test]
fn build_in_non_crate_directory_doesnt_panic() {
let fixture = utils::fixture::fixture("tests/fixtures/not-a-crate");
let cli = Cli::from_iter_safe(vec![
"wasm-pack",
"build",
&fixture.path.display().to_string(),
]).unwrap();
let logger = logger::new(&cli.cmd, cli.verbosity).unwrap();
assert!(
command::run_wasm_pack(cli.cmd, &logger).is_err(),
"running wasm-pack in a non-crate directory should fail, but it should not panic"
);
}

@ -3,9 +3,11 @@ extern crate failure;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate structopt;
extern crate tempfile;
extern crate wasm_pack;
mod build;
mod manifest;
mod readme;
mod utils;

@ -0,0 +1 @@
This is not a Rust crate!
Loading…
Cancel
Save