From 5458af77e2efbaa50e9eb22b946a83995ca5c4fd Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 9 Feb 2022 15:15:00 +0100 Subject: [PATCH] fix angular test --- examples/angular/jest.config.js | 2 +- examples/angular/test-env.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 examples/angular/test-env.js diff --git a/examples/angular/jest.config.js b/examples/angular/jest.config.js index 06e6c25e3075..18094f1ba955 100644 --- a/examples/angular/jest.config.js +++ b/examples/angular/jest.config.js @@ -1,7 +1,7 @@ module.exports = { moduleFileExtensions: ['ts', 'html', 'js', 'json'], setupFilesAfterEnv: ['/setupJest.js'], - testEnvironment: 'jsdom', + testEnvironment: '/test-env.js', transform: { '\\.[tj]s$': ['babel-jest', {configFile: require.resolve('./.babelrc')}], }, diff --git a/examples/angular/test-env.js b/examples/angular/test-env.js new file mode 100644 index 000000000000..1c06ac0b793e --- /dev/null +++ b/examples/angular/test-env.js @@ -0,0 +1,10 @@ +'use strict'; + +const BaseJSDOMEnv = require('jest-environment-jsdom'); + +module.exports = class AngularEnv extends BaseJSDOMEnv { + exportConditions() { + // we need to include `node` as `rxjs` defines `node`, `es2015`, `default`, not `browser` or `require` + return super.exportConditions().concat('node'); + } +};