Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(environment-jsdom): allow passing html content to jsdom environment #11950

Merged
merged 7 commits into from Oct 16, 2021
2 changes: 1 addition & 1 deletion packages/jest-environment-jsdom/src/index.ts
Expand Up @@ -31,7 +31,7 @@ class JSDOMEnvironment implements JestEnvironment<number> {
moduleMocker: ModuleMocker | null;

constructor(config: Config.ProjectConfig, options?: EnvironmentContext) {
this.dom = new JSDOM('<!DOCTYPE html>', {
this.dom = new JSDOM(typeof config.testEnvironmentOptions.html === 'string' ? config.testEnvironmentOptions.html : '<!DOCTYPE html>', {
pretendToBeVisual: true,
resources:
typeof config.testEnvironmentOptions.userAgent === 'string'
Expand Down