Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
to reproduce:
$ OPTIC__BUILD_SKIP__UI=yes task postpull
$ yarn workspace @useoptic/ui-v2 test
  • Loading branch information
devdoshi committed May 18, 2021
1 parent 588a76e commit 2a3fcf7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
17 changes: 15 additions & 2 deletions Cargo.lock

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

19 changes: 16 additions & 3 deletions workspaces/diff-engine-wasm/engine/Cargo.lock

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

2 changes: 2 additions & 0 deletions workspaces/diff-engine-wasm/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ wasm-logger = "0.2.0"
uuid = { version = "0.8.2", features = ["v4", "wasm-bindgen"] }

[dependencies.getrandom]
git = "https://github.com/rust-random/getrandom"
branch = "detect"
features = ["js"]

[dependencies.optic_diff_engine]
Expand Down
5 changes: 5 additions & 0 deletions workspaces/diff-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ tokio-util = { version = "0.6.3", features = ["codec"], optional = true }
tokio-stream = { version= "0.1.2", features = ["fs", "io-util"], optional = true }
uuid = { version = "0.8.2", features = ["v4", "wasm-bindgen"] }

[dependencies.getrandom]
git = "https://github.com/rust-random/getrandom"
branch = "detect"
features = ["js"]

[dev-dependencies]
insta = "0.16.1"
petgraph-evcxr = "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import { newDeterministicIdGenerator } from '<src>/lib/domain-id-generator';
import * as opticEngine from '@useoptic/diff-engine-wasm/engine/build';
import { AllPathsQuery } from '<src>/optic-components/hooks/usePathsHook';

//@GOTCHA: for some reason, probably because of jest, our wasm code thinks it is running in the browser even though it is running in node because of the presence of global.self:
//@REF: https://github.com/rust-random/getrandom/issues/214
//@ts-ignore
delete global.self;

export async function makeCurrentSpecContext(
events: any[],
query: (spectacleInput: SpectacleInput<any>) => Promise<any>
Expand Down Expand Up @@ -52,7 +47,7 @@ export async function makeCurrentSpecContext(
currentSpecResponses: responses,
currentSpecRequests: requests,
domainIds: newDeterministicIdGenerator(),
idGeneratorStrategy: 'sequential',
idGeneratorStrategy: 'random',
opticEngine,
};
}

0 comments on commit 2a3fcf7

Please sign in to comment.