Skip to content

Commit 42c47c6

Browse files
test: set up testing environment (#279)
* chore: add tests * chore: add mocha CLI and more tests * ci: add test workflow * ci: temporarily disable linting in test workflow * ci: disable tests on Linux and Windows for now --------- Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
1 parent 827f5c0 commit 42c47c6

File tree

11 files changed

+1946
-5
lines changed

11 files changed

+1946
-5
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_call:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Test
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
node-version:
19+
- '22.12.x'
20+
os:
21+
- macos-latest
22+
# TODO(dsanders11: Enable these once we fix tests on those platforms in CI
23+
# - ubuntu-latest
24+
# - windows-latest
25+
runs-on: "${{ matrix.os }}"
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29+
- name: Setup Node.js
30+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
31+
with:
32+
node-version: "${{ matrix.node-version }}"
33+
cache: 'npm'
34+
- name: Install dependencies
35+
run: npm ci
36+
# TODO(dsanders11): Enable this once we get a clean lint state on `main`
37+
# - name: Lint
38+
# run: npm run lint
39+
- name: Build
40+
run: npm run build
41+
- name: Test
42+
run: npm run test

eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import globals from 'globals';
44
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
55
import react from 'eslint-plugin-react';
66
import reactHooks from 'eslint-plugin-react-hooks';
7+
import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
78

89
export default tseslint.config(
910
eslint.configs.recommended,
@@ -14,10 +15,13 @@ export default tseslint.config(
1415
{
1516
files: ['**/*.{js,jsx,ts,tsx}'],
1617
plugins: {
18+
'chai-friendly': pluginChaiFriendly,
1719
unicorn: eslintPluginUnicorn,
1820
react: react,
1921
},
2022
rules: {
23+
'@typescript-eslint/no-unused-expressions': 'off',
24+
'chai-friendly/no-unused-expressions': 'error',
2125
'unicorn/prefer-node-protocol': 'error',
2226
'@typescript-eslint/no-explicit-any': 'off',
2327
'@typescript-eslint/consistent-type-imports': 'error',
@@ -37,6 +41,12 @@ export default tseslint.config(
3741
},
3842
},
3943
},
44+
{
45+
files: ['spec-electron-setup/**/*.{js,cjs,ts}'],
46+
rules: {
47+
'@typescript-eslint/no-require-imports': 'off',
48+
},
49+
},
4050
{
4151
settings: {
4252
react: {

0 commit comments

Comments
 (0)