-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Simen Bekkhus <[email protected]>
- Loading branch information
1 parent
31d092d
commit c3b3f90
Showing
10 changed files
with
599 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-disable import/no-default-export */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import CanvasKitInit from "canvaskit-wasm/bin/full/canvaskit"; | ||
import { TestEnvironment } from "jest-environment-node"; | ||
|
||
const CanvasKit = await CanvasKitInit({}); | ||
|
||
export default class SkiaEnvironment extends TestEnvironment { | ||
constructor(...args) { | ||
super(...args); | ||
this.global.CanvasKit = CanvasKit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable import/no-default-export */ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { TestEnvironment } from "jest-environment-node"; | ||
import { LoadSkiaWeb } from "@shopify/react-native-skia/lib/commonjs/web/LoadSkiaWeb"; | ||
|
||
const CanvasKit = await LoadSkiaWeb(); | ||
|
||
export default class SkiaEnvironment extends TestEnvironment { | ||
constructor(config, context) { | ||
super(config, context); | ||
} | ||
|
||
async setup() { | ||
await super.setup(); | ||
this.global.CanvasKit = CanvasKit; | ||
} | ||
|
||
async teardown() {} | ||
|
||
getVmContext() { | ||
return super.getVmContext(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { jest } from "@jest/globals"; | ||
import CanvasKitInit from "canvaskit-wasm/bin/full/canvaskit"; | ||
|
||
import Mock from "./src/mock"; | ||
|
||
global.CanvasKit = await CanvasKitInit({}); | ||
|
||
jest.mock("@shopify/react-native-skia", () => { | ||
jest.mock("@shopify/react-native-skia/lib/commonjs/Platform", () => { | ||
const Noop = () => undefined; | ||
return { | ||
OS: "web", | ||
PixelRatio: 1, | ||
requireNativeComponent: Noop, | ||
resolveAsset: Noop, | ||
findNodeHandle: Noop, | ||
NativeModules: Noop, | ||
View: Noop, | ||
}; | ||
}); | ||
return Mock.Mock(global.CanvasKit); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.