Skip to content

Commit

Permalink
run tests for browser/dedicated worker/shared worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Oct 21, 2024
1 parent 6737fb7 commit a19b92b
Show file tree
Hide file tree
Showing 52 changed files with 107 additions and 137 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,3 @@ jobs:
- name: Generate changelog
id: changelog
uses: ./.github/actions/changelog

- name: Echo changelog
run: echo -e "${{ steps.changelog.outputs.changelog }}"
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:

- name: Test (Chrome)
if: ${{ runner.os != 'macOS' }}
run: wasm-pack test --chrome --headless --locked --package idb_test ${{ inputs.flags }}
run: wasm-pack test --chrome --headless --locked ${{ inputs.flags }}

- name: Test (Firefox)
if: ${{ runner.os != 'macOS' }}
run: wasm-pack test --firefox --headless --locked --package idb_test ${{ inputs.flags }}
run: wasm-pack test --firefox --headless --locked ${{ inputs.flags }}

- name: Test (Safari)
if: ${{ runner.os == 'macOS' }}
run: wasm-pack test --safari --headless --locked --package idb_test ${{ inputs.flags }}
run: wasm-pack test --safari --headless --locked ${{ inputs.flags }}
1 change: 1 addition & 0 deletions .idea/indexed_db.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions .idea/runConfigurations/Sync_readme.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/runConfigurations/Test.xml

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/test_all_chrome.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/test_all_firefox.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 5 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ resolver = "2"
members = [
".",
"internal_macros",
"test",
]

[package]
Expand Down Expand Up @@ -31,6 +30,7 @@ cursors = [
]
dates = [
"dep:web-time",
"_serialise-deserialise-dyn",
]
indices = [
"web-sys/IdbIndex",
Expand All @@ -51,7 +51,7 @@ streams = [
switch = []
typed-arrays = []
version-change = ["tokio/macros"]
__unit-tests = ["dep:log"]
_serialise-deserialise-dyn = []

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
Expand Down Expand Up @@ -97,7 +97,6 @@ fancy_constructor = { workspace = true }
futures-core = { workspace = true, optional = true }
impartial-ord = { workspace = true, optional = true }
js-sys = { workspace = true }
log = { workspace = true, optional = true }
sealed = { workspace = true }
serde = { workspace = true, optional = true }
smallvec = { workspace = true }
Expand Down Expand Up @@ -137,7 +136,13 @@ features = [
]

[dev-dependencies]
console_log = { workspace = true }
futures = { workspace = true }
impartial-ord = { workspace = true }
log = { workspace = true }
rand = { workspace = true }
uuid = { workspace = true, features = ["v4", "js"] }
wasm-bindgen-test = { workspace = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
5 changes: 3 additions & 2 deletions internal_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ pub fn derive_from_dom_exception(input: TokenStream1) -> TokenStream1 {
///
/// # Example
///
/// ```rust
#[cfg_attr(doctest, doc = " ````no_test")]
/// ```
/// #[errdoc(
/// InvalidStateError("Thrown when bars do a foo."),
/// )]
/// ```
/// ````
#[proc_macro_attribute]
pub fn errdoc(defs: TokenStream1, function: TokenStream1) -> TokenStream1 {
errdoc::Errdoc::exec(defs, function)
Expand Down
41 changes: 0 additions & 41 deletions test/Cargo.toml

This file was deleted.

6 changes: 6 additions & 0 deletions tests/browser.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_worker);

pub mod tests;

#[allow(unused_imports)]
use tests::prelude;
5 changes: 5 additions & 0 deletions tests/dedicated_worker.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_dedicated_worker);

pub mod tests;
#[allow(unused_imports)]
use tests::prelude;
5 changes: 5 additions & 0 deletions tests/shared_worker.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_shared_worker);

pub mod tests;
#[allow(unused_imports)]
use tests::prelude;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/src/database/open.rs → tests/tests/database/open.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::random_db_versions;
use crate::prelude::*;
use idb_fut::database::Database;
use idb_fut::error::{JSError, OpenDbError};
use idb_fut::error::{Error, JSError, OpenDbError};
use tokio::sync::oneshot;
use wasm_bindgen_futures::spawn_local;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn stream() {
}

mod helpers {
use idb_fut::database::Database;
use indexed_db_futures::database::Database;
use wasm_bindgen_futures::spawn_local;

pub fn open_v2(db_name: String, version: u8) {
Expand Down
1 change: 1 addition & 0 deletions test/src/date.rs → tests/tests/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::prelude::*;
use idb_fut::date::*;

#[wasm_bindgen_test]
#[cfg(feature = "serde")]
pub async fn serialisation() {
// Strip nanos
let now = {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a19b92b

Please sign in to comment.