Skip to content

Commit

Permalink
Running E2E tests to confirm browser compatibility. (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwoplaza authored Jul 21, 2024
1 parent 56d9c4e commit a3a8656
Show file tree
Hide file tree
Showing 8 changed files with 1,050 additions and 36 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/browser-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Browser compatibility tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
cypress-run:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Cypress run
uses: cypress-io/github-action@v6
with:
install-command: pnpm i --frozen-lockfile
build: pnpm build
command: pnpm cypress run
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Code analysis & unit tests

on:
push:
Expand Down
7 changes: 7 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
supportFile: false,
},
});
13 changes: 13 additions & 0 deletions cypress/e2e/bufferWriter.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BufferReader, BufferWriter } from 'typed-binary';

describe('BufferWriter', () => {
it('writes and reads from an ArrayBuffer', () => {
const buffer = new ArrayBuffer(64);
const writer = new BufferWriter(buffer);

writer.writeUint32(256);

const reader = new BufferReader(buffer);
expect(reader.readUint32()).to.equal(256);
});
});
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@types/node": "^20.14.11",
"cypress": "^13.13.1",
"socket.io": "^4.7.5",
"socket.io-client": "^4.7.5",
"tsup": "^8.2.0",
"typescript": "^5.5.2",
"vitest": "^1.6.0"
"vitest": "^1.6.0",
"typed-binary": "workspace:*"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit a3a8656

Please sign in to comment.