Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yandeu committed Dec 23, 2024
1 parent 8fbe6f9 commit 66f8b34
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
],
"dependencies": {
"canvas": "^2.10.2",
"jsdom": "^20.0.3",
"jsdom": "^25.0.1",
"phaser3spectorjs": "npm:empty-npm-package@1.0.0"
},
"devDependencies": {
"@types/jsdom": "^20.0.1",
"@tsconfig/node18": "^18.2.4",
"@types/jsdom": "^21.1.7",
"@types/node": "^16.4.0",
"@yandeu/prettier-config": "^0.0.3",
"axios": "^0.24.0",
Expand All @@ -43,7 +44,7 @@
"nodemon": "^2.0.4",
"npm-run-all": "^4.1.5",
"phaser": "^3.60.0",
"typescript": "^4.3.5"
"typescript": "^5.7.2"
},
"directories": {
"lib": "lib"
Expand All @@ -59,4 +60,4 @@
"funding": {
"url": "https://github.com/sponsors/yandeu"
}
}
}
6 changes: 6 additions & 0 deletions src/fakeScreen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global.screen = {
// @ts-expect-error
orientation: {
addEventListener: () => {}
}
}
4 changes: 2 additions & 2 deletions src/fakeXMLHttpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import path from 'path'
import fs from 'fs'

class FakeXMLHttpRequest {
public url: string
public url!: string
public status = 200
public response: any
public responseText: string
public responseText: string | undefined

public open(_type: string, url: string) {
this.url = path.resolve(__dirname, url)
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare global {
import Canvas from 'canvas'
import jsdom from 'jsdom'
import FakeXMLHttpRequest from './fakeXMLHttpRequest'
import './fakeScreen'

const { JSDOM } = jsdom
const dom = new JSDOM(`<!DOCTYPE html><body></body>`)
Expand Down
12 changes: 4 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"target": "ES2015",
"module": "CommonJS",

"rootDir": "./src",
"outDir": "./lib",

"lib": ["es2023", "dom"],

"sourceMap": true,
"declaration": true,
"declarationMap": true,

"esModuleInterop": true,
"strict": true,
"strictPropertyInitialization": false
"declarationMap": true
}
}

0 comments on commit 66f8b34

Please sign in to comment.