Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-web tet fails, no .js file found #243

Open
scifi6546 opened this issue Apr 4, 2020 · 5 comments
Open

cargo-web tet fails, no .js file found #243

scifi6546 opened this issue Apr 4, 2020 · 5 comments

Comments

@scifi6546
Copy link

scifi6546 commented Apr 4, 2020

I setup a empty repository with no tests and cargo-web complains that it can not find a .js file. I have chromium installed and I am running on ubuntu 20.04

cargo-web test --verbose
       Fresh cargo-web-test v0.1.0 (/home/nick/programming/cargo-web-test)
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
thread 'main' panicked at 'internal error: no .js file found', /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-web-0.6.26/src/test_chromium.rs:125:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
cargo-web -V    
cargo-web 0.6.26
@shanemadden
Copy link

Are you running on the nightly builds? I noticed this start to occur when the nightly build updated to a 1.44 version from 1.43.

@Azaril
Copy link

Azaril commented Apr 26, 2020

I root caused this to the .wasm artifact that is generated now gets put under the /target/deps/ folder whereas previously it was just under /target/. This causes it to be explicitly filtered out by cargo-web as they do some modifications to the wasm as a post-process step. I'll report the details on cargo-web and see if I can put together a PR for a fix.

For reference see cargo-web - src\build.rs:

fn build_or_check( &self, config: &AggregatedConfig, target: &CargoTarget, should_build: bool ) -> Result< CargoResult, Error > {

...

build_config.build( Some( |artifacts: Vec< PathBuf >| {
                let mut out = Vec::new();
                for path in artifacts {
                    let skip =
                        is_wasm32_unknown_unknown &&
                        path.extension().map( |ext| ext == "wasm" ).unwrap_or( false ) &&
                        path.parent().and_then( |parent| parent.file_name() ).map( |dir| dir == "deps" ).unwrap_or( false );

                    if skip {
                        continue;
                    }

                    if let Some( artifact ) = wasm::process_wasm_file( config.uses_old_stdweb, self.build_args.runtime, &build_config, &prepend_js, target_dir, &path ) {
                        debug!( "Generated artifact: {:?}", artifact );
                        out.push( artifact );
                    }

                    out.push( path );
                }

                out
            }))

@Azaril
Copy link

Azaril commented Apr 26, 2020

It looks like for emscripten you will also need this change: #244

There are several assumptions around not dealing with .wasm files under the deps folder for cdylib crates. I am not familiar enough with the code base to identify the right fix here without causing breakage to other tests.

This commit from last April is now unfortunatley not compaible with the changes made by the build tools: 0f6c482#diff-9300feef84bdf7e5ab58b05fa4eb0794

@lukaslueg
Copy link

@koute is this project still alive?

josephlr added a commit to josephlr/getrandom that referenced this issue Jul 21, 2020
Right now "cargo web test" is broken due to upstream changes. We will
disable stdweb tests until the stdweb project fixes things.

See: koute/cargo-web#243

Signed-off-by: Joe Richey <joerichey@google.com>
@josephlr
Copy link

We had to remove stdweb from our CI (rust-random/getrandom#154) due to this. Is there a way to work around this issue?

josephlr added a commit to josephlr/getrandom that referenced this issue Jul 21, 2020
Right now "cargo web test" is broken due to upstream changes. We will
disable stdweb tests until the stdweb project fixes things.

See: koute/cargo-web#243

Signed-off-by: Joe Richey <joerichey@google.com>
josephlr added a commit to rust-random/getrandom that referenced this issue Jul 21, 2020
Right now "cargo web test" is broken due to upstream changes. We will
disable stdweb tests until the stdweb project fixes things.

See: koute/cargo-web#243

Signed-off-by: Joe Richey <joerichey@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants