From 28b440a4babac4a0864c7ef32c2a894494d2fd28 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 11 Feb 2021 15:02:13 -0700 Subject: [PATCH] feat: add cssStub to jest --- package.json | 5 ++++- test/cssStub.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/cssStub.ts diff --git a/package.json b/package.json index 7f427a78..af412f5c 100644 --- a/package.json +++ b/package.json @@ -153,6 +153,9 @@ "/release-npm-package", "/release-gcp", "/release-images" - ] + ], + "moduleNameMapper": { + "^.+\\.(css|less)$": "/test/cssStub.ts" + } } } diff --git a/test/cssStub.ts b/test/cssStub.ts new file mode 100644 index 00000000..06aeb475 --- /dev/null +++ b/test/cssStub.ts @@ -0,0 +1,5 @@ +// Note: this is needed for the register.test.ts +// This is because inside src/browser/register.ts +// we import CSS files, which Jest can't handle unless we tell it how to +// See: https://stackoverflow.com/a/39434579/3015595 +module.exports = {}