Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v10.10.1
Choose a base ref
...
head repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v10.10.2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 17, 2023

  1. Copy the full SHA
    72ab603 View commit details
  2. Merge pull request #1019 from capricorn86/task/868-allow-setting-the-…

    …base-url
    
    #868@patch: Sets default URL for @happy-dom/jest-environment to "http…
    capricorn86 authored Aug 17, 2023
    Copy the full SHA
    059d382 View commit details
Showing with 6 additions and 0 deletions.
  1. +2 −0 packages/jest-environment/src/index.ts
  2. +4 −0 packages/jest-environment/test/javascript/JavaScript.test.ts
2 changes: 2 additions & 0 deletions packages/jest-environment/src/index.ts
Original file line number Diff line number Diff line change
@@ -68,6 +68,8 @@ export default class HappyDOMEnvironment implements JestEnvironment {

if (projectConfig.testEnvironmentOptions['url']) {
this.window.happyDOM.setURL(String(projectConfig.testEnvironmentOptions['url']));
} else {
this.window.happyDOM.setURL('http://localhost/');
}

this.fakeTimers = new LegacyFakeTimers({
4 changes: 4 additions & 0 deletions packages/jest-environment/test/javascript/JavaScript.test.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,10 @@ describe('JavaScript', () => {
expect({}.constructor).toBe(Object);
});

it('Document.location.href should be "http://localhost/", which is the default for the JSDOM Jest environment', () => {
expect(document.location.href).toBe('http://localhost/');
});

it('Can perform a real fetch()', async () => {
const express = Express();