Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update test stack #197

Merged
merged 6 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ module.exports = {
env: {
browser: true,
es2021: true,
"jest/globals": true,
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:vitest/recommended",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 13,
sourceType: "module",
},
plugins: [
"vitest"
],
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
Expand Down
66 changes: 37 additions & 29 deletions .github/workflows/checkpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
branches:
- main

env:
lockfile: pnpm-lock.yaml
node_version: "18"
pnpm_version: "8"


# This is to avoid running multiple actions when a PR is updated repeatedly. See
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
Expand All @@ -18,52 +24,54 @@ concurrency:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
name: Install PNPM
id: pnpm-install
with:
node-version: "16"
version: ${{ env.pnpm_version }}

- name: Cache node modules
id: cache-node
uses: actions/[email protected]
- name: Set up Node.js
uses: actions/setup-node@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}

- name: Install Dependencies
run: npm ci
- name: Install dependencies
run: pnpm install

- name: Lint
run: npm run lint:ci
run: pnpm run lint:ci

- name: Types
run: npm run types:check
run: pnpm run types:check

test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
name: Install PNPM
id: pnpm-install
with:
node-version: "16"
version: ${{ env.pnpm_version }}

- name: Cache node modules
id: cache-node
uses: actions/[email protected]
- name: Set up Node.js
uses: actions/setup-node@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}

- name: Install Dependencies
run: npm ci
- name: Install dependencies
run: pnpm install

- name: Tests
run: npm run test
run: pnpm run test
6 changes: 0 additions & 6 deletions jest.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions mocks/api-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ function addEvent(
productId: string,
eventType: string,
event: any,
session: string
session: string,
): void {
const namespacedProductId = `${session}-${eventType}-${productId}`;
if (!events[namespacedProductId]) {
events[namespacedProductId] = [];
}
events[namespacedProductId].push(event);
events[namespacedProductId]?.push(event);
}

function getNetworkIp(): string {
Expand Down Expand Up @@ -89,5 +89,5 @@ app.get("/test/events", (req, res) => {
});

app.listen(PORT, () =>
console.log(`Visit http://${getNetworkIp()}:${PORT}/test.html`)
console.log(`Visit http://${getNetworkIp()}:${PORT}/test.html`),
);
Loading