Skip to content

Commit

Permalink
test: fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Oct 5, 2023
1 parent 7ae588b commit c85287a
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 297 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: true

- uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm

- run: pnpm lint
- run: pnpm t
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"module": "src/index.ts",
"type": "module",
"scripts": {
"dev": "vite examples"
"dev": "vite examples",
"lint": "eslint src",
"test": "vitest -c tests/vitest.config.ts"
},
"devDependencies": {
"@arianrhodsandlot/eslint-config": "0.8.2",
"@happy-dom/global-registrator": "12.5.0",
"@types/ini": "^1.3.31",
"@types/lodash-es": "^4.17.9",
"@types/ini": "1.3.31",
"@types/lodash-es": "4.17.9",
"browserfs": "1.4.3",
"buffer": "^6.0.3",
"bun-types": "1.0.3",
"buffer": "6.0.3",
"delay": "6.0.0",
"eslint": "8.50.0",
"happy-dom": "12.8.0",
"ini": "4.1.1",
"ky": "1.0.1",
"ky-universal": "0.12.0",
"lodash-es": "^4.17.21",
"lodash-es": "4.17.21",
"typescript": "5.2.2",
"vite": "4.4.10",
"vite": "4.4.11",
"vitest": "0.34.6"
}
}
110 changes: 23 additions & 87 deletions pnpm-lock.yaml

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

5 changes: 3 additions & 2 deletions src/emscripten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmscriptenFS, FileSystem, initialize } from 'browserfs'

const userdataDir = '/home/web_user/retroarch/userdata'

export async function createEmscriptenFS({ FS, PATH, ERRNO_CODES }) {
export function createEmscriptenFS({ FS, PATH, ERRNO_CODES }: any) {
const inMemoryFS = new FileSystem.InMemory()
const mountableFS = new FileSystem.MountableFileSystem()
try {
Expand All @@ -14,7 +14,8 @@ export async function createEmscriptenFS({ FS, PATH, ERRNO_CODES }) {

return new EmscriptenFS(FS, PATH, ERRNO_CODES)
}
export function getEmscriptenModuleOverrides(overrides: Partial<EmscriptenModule>) {

export function getEmscriptenModuleOverrides(overrides: any) {
let resolveRunDependenciesPromise: () => void
const runDependenciesPromise = new Promise<void>((resolve) => {
resolveRunDependenciesPromise = resolve
Expand Down
16 changes: 1 addition & 15 deletions src/emulator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ini from 'ini'
import { kebabCase } from 'lodash-es'
import { coreFullNameMap } from './constants'
import { createEmscriptenFS, getEmscriptenModuleOverrides } from './emscripten'
import { EmulatorOptions } from './types/emulator-options'
Expand All @@ -14,22 +13,9 @@ function delay(time: number) {
})
}
const raUserdataDir = '/home/web_user/retroarch/userdata/'
const raCoreConfigDir = `${raUserdataDir}config/`
// const raCoreConfigDir = `${raUserdataDir}config/`
const raConfigPath = `${raUserdataDir}retroarch.cfg`

function updateStyle(element: HTMLElement, style: Partial<CSSStyleDeclaration>) {
if (!element) {
return
}
for (const rule in style) {
if (style[rule]) {
element.style.setProperty(kebabCase(rule), style[rule] as string)
} else {
element.style.removeProperty(rule)
}
}
}

type GameStatus = 'initial' | 'paused' | 'running'

export class Emulator {
Expand Down
2 changes: 1 addition & 1 deletion src/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ky from 'ky-universal'
import ky from 'ky'

export const http = ky.create({
timeout: false,
Expand Down
Loading

0 comments on commit c85287a

Please sign in to comment.