Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 6f3926d

Browse files
authored
feat(test): moving unit testing over to vitest (#126)
1 parent 741f9c8 commit 6f3926d

File tree

114 files changed

+6167
-16730
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+6167
-16730
lines changed

Diff for: .eslintignore

-1
This file was deleted.

Diff for: .eslintrc

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"@readme/eslint-config",
5+
"@readme/eslint-config/typescript"
6+
],
7+
"parserOptions": {
8+
"ecmaVersion": 2020
9+
},
10+
"env": {
11+
"node": true,
12+
"browser": true
13+
},
14+
"rules": {
15+
"consistent-return": "off",
16+
"no-plusplus": "off",
17+
"no-restricted-syntax": "off",
18+
"no-underscore-dangle": "off",
19+
"no-unused-vars": "off",
20+
"no-use-before-define": "off",
21+
"node/no-deprecated-api": "off", // `url.parse` has been deprecated but `url.URL` isn't a good replacement yet.
22+
"prefer-rest-params": "off"
23+
},
24+
"overrides": [
25+
{
26+
// The typings in this file are pretty bad right now, when we have native types we can
27+
// remove this.
28+
"files": ["lib/index.d.ts"],
29+
"rules": {
30+
"@typescript-eslint/array-type": "off",
31+
"@typescript-eslint/consistent-indexed-object-style": "off",
32+
"@typescript-eslint/consistent-type-imports": "off",
33+
"@typescript-eslint/no-explicit-any": "off",
34+
"@typescript-eslint/sort-type-constituents": "off",
35+
"eslint-comments/no-unused-disable": "off",
36+
"lines-between-class-members": "off",
37+
"max-classes-per-file": "off",
38+
"typescript-sort-keys/interface": "off",
39+
"unicorn/custom-error-definition": "off"
40+
}
41+
},
42+
{
43+
// These can all get removed when the library is moved over to native TS.
44+
"files": ["*.js"],
45+
"rules": {
46+
"@typescript-eslint/no-shadow": "off",
47+
"@typescript-eslint/no-this-alias": "off",
48+
"@typescript-eslint/no-unused-vars": "off",
49+
"@typescript-eslint/no-use-before-define": "off",
50+
"@typescript-eslint/no-var-requires": "off",
51+
"func-names": "off",
52+
"no-unused-expressions": "off"
53+
}
54+
}
55+
],
56+
}

Diff for: .eslintrc.yml

-18
This file was deleted.

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*.js text eol=lf
1818
*.jsx text eol=lf
1919
*.ts text eol=lf
20+
*.mts text eol=lf
2021
*.tsx text eol=lf
2122
*.json text eol=lf
2223
*.yml text eol=lf

Diff for: .github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: github-actions
4-
directory: "/"
4+
directory: '/'
55
schedule:
66
interval: monthly
77
reviewers:
@@ -13,7 +13,7 @@ updates:
1313
prefix-development: chore(deps-dev)
1414

1515
- package-ecosystem: npm
16-
directory: "/"
16+
directory: '/'
1717
schedule:
1818
interval: monthly
1919
open-pull-requests-limit: 10

Diff for: .github/workflows/ci.yml

+8-73
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@ name: CI
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
6-
schedule:
7-
- cron: "0 0 1 * *"
88

99
jobs:
10-
linting:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@v4
15-
- run: npm ci
16-
- run: npm run lint
17-
18-
node_tests:
10+
test:
1911
name: Node ${{ matrix.node }} on ${{ matrix.os }}
2012
runs-on: ${{ matrix.os }}
2113
timeout-minutes: 10
@@ -37,67 +29,10 @@ jobs:
3729
uses: actions/setup-node@v4
3830
with:
3931
node-version: ${{ matrix.node }}
32+
cache: npm
4033

41-
- name: Get npm cache directory
42-
id: npm-cache-dir
43-
run: |
44-
echo "::set-output name=dir::$(npm config get cache)"
45-
46-
- uses: actions/cache@v4
47-
id: npm-cache
48-
with:
49-
path: ${{ steps.npm-cache-dir.outputs.dir }}
50-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
51-
restore-keys: |
52-
${{ runner.os }}-node-
53-
54-
- name: Install dependencies
55-
run: npm ci
56-
57-
- name: Run TypeScript tests
58-
run: npm run test:typescript
59-
60-
- name: Run Node tests
61-
run: npm run coverage:node
62-
63-
browser_tests:
64-
name: Browser
65-
runs-on: ${{ matrix.os }}
66-
timeout-minutes: 15
67-
strategy:
68-
fail-fast: true
69-
matrix:
70-
browser:
71-
- chrome
72-
- firefox
73-
os:
74-
- ubuntu-latest
75-
- windows-latest
76-
77-
steps:
78-
- name: Checkout source
79-
uses: actions/checkout@v4
80-
81-
- name: Install Node
82-
uses: actions/setup-node@v4
83-
84-
- name: Install dependencies
85-
run: npm ci
86-
87-
# Chrome
88-
- uses: browser-actions/setup-chrome@latest
89-
if: matrix.browser == 'chrome'
90-
91-
- name: Run tests on Chrome
92-
if: matrix.browser == 'chrome'
93-
run: |
94-
npm run test:browser -- --browsers=ChromeHeadless
95-
96-
# Firefox
97-
- uses: browser-actions/setup-chrome@latest
98-
if: matrix.browser == 'firefox'
34+
- run: npm ci
35+
- run: npm run lint
9936

100-
- name: Run tests on Firefox
101-
if: matrix.browser == 'firefox'
102-
run: |
103-
npm run test:browser -- --browsers=FirefoxHeadless
37+
- name: Run tests
38+
run: npm run test --ignore-scripts

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ nbproject
1313
# IDEs & Text Editors
1414
.idea
1515
.sublime-*
16-
.vscode/settings.json
1716
.netbeans
1817
nbproject
1918

Diff for: .mocharc.yml

-9
This file was deleted.

Diff for: .nycrc.yml

-10
This file was deleted.

Diff for: .prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
coverage/
1+
test/specs/invalid/invalid.json

Diff for: .vscode/launch.json

-47
This file was deleted.

Diff for: .vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll": "explicit"
4+
}
5+
}

Diff for: .vscode/tasks.json

-34
This file was deleted.

0 commit comments

Comments
 (0)