From 880f1a0c9e02c18288500b6eb265a23a4f01b217 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 | 12 ++++++++++++ 2 files changed, 13 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..29e800ced2b0 --- /dev/null +++ b/examples/angular/test-env.js @@ -0,0 +1,12 @@ +'use strict'; + +const { + TestEnvironment: JSDOMTestEnvironment, +} = require('jest-environment-jsdom'); + +module.exports = class AngularEnv extends JSDOMTestEnvironment { + exportConditions() { + // we need to include `node` as `rxjs` defines `node`, `es2015`, `default`, not `browser` or `require` + return super.exportConditions().concat('node'); + } +};