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.11.2
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: v11.0.0
Choose a head ref
  • 8 commits
  • 49 files changed
  • 1 contributor

Commits on Sep 4, 2023

  1. Copy the full SHA
    21fd662 View commit details

Commits on Sep 5, 2023

  1. Copy the full SHA
    095390e View commit details
  2. Copy the full SHA
    9c2b136 View commit details

Commits on Sep 6, 2023

  1. Copy the full SHA
    7d4750e View commit details
  2. #1030@major: Adds logic for catching both synchronous and asynchronou…

    …s errors in scripts, event listeners and timers. Adds a new package called "@happy-dom/uncaught-exception-observer". Adds a new virtual console that by default will output all log entries to a virtual console printer instead of using the global NodeJS console.
    capricorn86 committed Sep 6, 2023
    Copy the full SHA
    4570bac View commit details
  3. Copy the full SHA
    67608e5 View commit details
  4. Copy the full SHA
    b19d2d1 View commit details
  5. Merge pull request #1044 from capricorn86/task/1030-uncaught-exceptio…

    …ns-thrown-asynchronously-are-not-handled-by-windowonerror2
    
    Task/1030 uncaught exceptions thrown asynchronously are not handled by windowonerror2
    capricorn86 authored Sep 6, 2023
    Copy the full SHA
    5aab0ec View commit details
Showing with 2,596 additions and 8,023 deletions.
  1. +4 −0 README.md
  2. +78 −12 package-lock.json
  3. +1 −0 package.json
  4. +2 −3 packages/global-registrator/tsconfig.json
  5. +1 −1 packages/happy-dom/.eslintrc.cjs
  6. +11 −18 packages/happy-dom/bin/change-file-extension.cjs
  7. +1 −1 packages/happy-dom/package.json
  8. +356 −0 packages/happy-dom/src/console/VirtualConsole.ts
  9. +107 −0 packages/happy-dom/src/console/VirtualConsolePrinter.ts
  10. +12 −0 packages/happy-dom/src/console/enums/VirtualConsoleLogLevelEnum.ts
  11. +29 −0 packages/happy-dom/src/console/enums/VirtualConsoleLogTypeEnum.ts
  12. +10 −0 packages/happy-dom/src/console/types/IVirtualConsoleLogEntry.ts
  13. +6 −0 packages/happy-dom/src/console/types/IVirtualConsoleLogGroup.ts
  14. +58 −0 packages/happy-dom/src/console/types/IVirtualConsolePrinter.ts
  15. +100 −0 packages/happy-dom/src/console/utilities/VirtualConsoleLogEntryStringifier.ts
  16. +27 −5 packages/happy-dom/src/event/EventTarget.ts
  17. +1 −1 packages/happy-dom/src/nodes/element/Element.ts
  18. +13 −35 packages/happy-dom/src/nodes/html-link-element/HTMLLinkElementUtility.ts
  19. +4 −1 packages/happy-dom/src/nodes/html-script-element/HTMLScriptElement.ts
  20. +19 −62 packages/happy-dom/src/nodes/html-script-element/HTMLScriptElementUtility.ts
  21. +1 −10 packages/happy-dom/src/window/GlobalWindow.ts
  22. +1 −0 packages/happy-dom/src/window/IHappyDOMOptions.ts
  23. +2 −8 packages/happy-dom/src/window/IWindow.ts
  24. +1 −0 packages/happy-dom/src/window/VMGlobalPropertyScript.ts
  25. +77 −70 packages/happy-dom/src/window/Window.ts
  26. +94 −0 packages/happy-dom/src/window/WindowErrorUtility.ts
  27. +279 −0 packages/happy-dom/test/console/VirtualConsole.test.ts
  28. +459 −0 packages/happy-dom/test/console/VirtualConsolePrinter.test.ts
  29. +72 −0 packages/happy-dom/test/nodes/html-script-element/HTMLScriptElement.test.ts
  30. +44 −4 packages/happy-dom/test/nodes/node/Node.test.ts
  31. +31 −0 packages/happy-dom/test/window/GlobalWindow.test.ts
  32. +182 −2 packages/happy-dom/test/window/Window.test.ts
  33. +2 −3 packages/happy-dom/tsconfig.json
  34. +0 −7,784 packages/jest-environment/package-lock.json
  35. +4 −3 packages/jest-environment/src/index.ts
  36. +8 −0 packages/uncaught-exception-observer/.editorconfig
  37. +1 −0 packages/uncaught-exception-observer/.eslintrc.cjs
  38. +4 −0 packages/uncaught-exception-observer/.gitignore
  39. +5 −0 packages/uncaught-exception-observer/.npmignore
  40. +1 −0 packages/uncaught-exception-observer/.prettierrc.cjs
  41. +21 −0 packages/uncaught-exception-observer/LICENSE
  42. +110 −0 packages/uncaught-exception-observer/README.md
  43. +96 −0 packages/uncaught-exception-observer/package.json
  44. +93 −0 packages/uncaught-exception-observer/src/UncaughtExceptionObserver.ts
  45. +3 −0 packages/uncaught-exception-observer/src/index.ts
  46. +108 −0 packages/uncaught-exception-observer/test/UncaughtExceptionObserver.test.ts
  47. +12 −0 packages/uncaught-exception-observer/test/tsconfig.json
  48. +37 −0 packages/uncaught-exception-observer/tsconfig.json
  49. +8 −0 packages/uncaught-exception-observer/vitest.config.ts
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,6 +63,10 @@ This package makes it possible to use Happy DOM with [Jest](https://jestjs.io/).

### [![Published on npm](https://img.shields.io/npm/v/@happy-dom/global-registrator.svg)](https://www.npmjs.com/package/@happy-dom/global-registrator) [global-registrator](https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator)

---

### [![Published on npm](https://img.shields.io/npm/v/@happy-dom/uncaught-exception-observer.svg)](https://www.npmjs.com/package/@happy-dom/uncaught-exception-observer) [global-registrator](https://github.com/capricorn86/happy-dom/tree/master/packages/uncaught-exception-observer)

A utility that registers Happy DOM globally, which makes it possible to use Happy DOM for testing in a Node environment.

# Performance
90 changes: 78 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
"scripts": {
"compile": "turbo run compile --cache-dir=.turbo",
"watch": "turbo run watch --parallel",
"clean": "git clean -Xdfq",
"lint": "turbo run lint --cache-dir=.turbo",
"lint:fix": "turbo run lint:fix",
"test": "turbo run test --cache-dir=.turbo",
5 changes: 2 additions & 3 deletions packages/global-registrator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"tsBuildInfoFile": "tmp/.tsbuildinfo",
"target": "es2020",
"declaration": true,
"declarationMap": true,
@@ -19,8 +18,8 @@
"sourceMap": true,
"skipLibCheck": true,
"baseUrl": ".",
"composite": true,
"incremental": true,
"composite": false,
"incremental": false,
"jsx": "react",
"types": [
"node"
2 changes: 1 addition & 1 deletion packages/happy-dom/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ module.exports = {
],
'@typescript-eslint/ban-ts-comment': OFF,
'jsdoc/no-types': WARN,
'import/named': WARN,
'import/named': OFF,
'import/no-named-as-default': WARN,
'import/no-extraneous-dependencies': WARN,
'import/no-absolute-path': WARN,
29 changes: 11 additions & 18 deletions packages/happy-dom/bin/change-file-extension.cjs
Original file line number Diff line number Diff line change
@@ -64,25 +64,18 @@ async function renameFiles(files, args) {
for (const file of newFiles) {
writePromises.push(
FS.promises.readFile(file.oldPath).then((content) => {
return FS.promises
.writeFile(
file.newPath,
content
.toString()
.replace(
new RegExp(`${args.fromExt.replace('.', '\\.')}\\.map`, 'g'),
`${args.toExt}.map`
)
.replace(
new RegExp(`${args.fromExt.replace('.', '\\.')}(["'])`, 'g'),
`${args.toExt}$1`
)
const oldContent = content.toString();
const newContent = oldContent
.replace(
new RegExp(`${args.fromExt.replace('.', '\\.')}\\.map`, 'g'),
`${args.toExt}.map`
)
.then(() => {
if (file.oldPath !== file.newPath) {
return FS.promises.unlink(file.oldPath);
}
});
.replace(new RegExp(`${args.fromExt.replace('.', '\\.')}(["'])`, 'g'), `${args.toExt}$1`);
return FS.promises.writeFile(file.newPath, newContent).then(() => {
if (file.oldPath !== file.newPath) {
return FS.promises.unlink(file.oldPath);
}
});
})
);
}
2 changes: 1 addition & 1 deletion packages/happy-dom/package.json
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@
"test": "vitest run",
"test:ui": "vitest --ui",
"test:watch": "vitest",
"test:debug": "vitest --inspect-brk --threads false"
"test:debug": "vitest run --inspect-brk --threads false"
},
"dependencies": {
"css.escape": "^1.5.1",
Loading