Skip to content

Commit

Permalink
chore: Change to vitest (#24)
Browse files Browse the repository at this point in the history
Motivation is to allow usage of snapshot testing in the tests.
  • Loading branch information
arv authored Jan 23, 2024
1 parent 168241d commit e018987
Show file tree
Hide file tree
Showing 8 changed files with 1,282 additions and 467 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
out
.eslintrc.cjs
web-test-runner.config.mjs
rollup.config.js
vitest.config.ts
1,664 changes: 1,258 additions & 406 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
"lint": "eslint --ext .ts,.tsx,.js,.jsx src/",
"build": "tsc",
"prepack": "npm run check-format && npm run lint && npm run test && npm run build",
"test": "web-test-runner",
"test:watch": "npm test -- --watch"
"test": "vitest run --browser.provider=playwright --browser.name=chromium --browser.headless",
"test:watch": "vitest watch --browser.provider=playwright --browser.name=chromium --browser.headless"
},
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@rocicorp/eslint-config": "^0.5.1",
"@rocicorp/prettier-config": "^0.2.0",
"@rocicorp/logger": "^5.2.1",
"@rocicorp/reflect": "^0.38.202311200859",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@rocicorp/reflect": "^0.39.202401100534",
"@web/dev-server": "^0.4.1",
"@web/dev-server-esbuild": "^1.0.1",
"@web/dev-server-import-maps": "^0.2.0",
"@web/test-runner": "^0.18.0",
"@web/test-runner-playwright": "^0.11.0",
"chai": "^5.0.0-alpha.2",
"nanoid": "^5.0.3",
"replicache": "14.0.0",
"typescript": "^5.3.2",
"zod": "^3.22.4"
"nanoid": "^5.0.4",
"replicache": "14.0.3",
"typescript": "^5.3.3",
"zod": "^3.22.4",
"@vitest/browser": "^1.2.1",
"playwright": "^1.41.1",
"vitest": "^1.2.1"
},
"files": [
"out/",
Expand Down
2 changes: 1 addition & 1 deletion src/generate-presence.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {OptionalLogger} from '@rocicorp/logger';
import {Reflect} from '@rocicorp/reflect/client';
import {expect} from 'chai';
import {nanoid} from 'nanoid';
import {MutatorDefs, Replicache, TEST_LICENSE_KEY} from 'replicache';
import {expect, suite, test} from 'vitest';
import {ZodError, ZodTypeAny, z} from 'zod';
import {
ListOptionsForPresence,
Expand Down
2 changes: 1 addition & 1 deletion src/generate.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type {OptionalLogger} from '@rocicorp/logger';
import {Reflect} from '@rocicorp/reflect/client';
import {expect} from 'chai';
import {nanoid} from 'nanoid';
import {MutatorDefs, Replicache, TEST_LICENSE_KEY} from 'replicache';
import {expect, suite, test} from 'vitest';
import {ZodError, ZodTypeAny, z} from 'zod';
import {ListOptions, WriteTransaction, generate} from './generate.js';
import {ReadonlyJSONObject, ReadonlyJSONValue} from './json.js';
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"forceConsistentCasingInFileNames": true,
"moduleResolution": "Node16",
"allowJs": true,
"skipLibCheck": true
"skipLibCheck": true,
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "out"]
"exclude": ["node_modules", "out"],
}
9 changes: 9 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {defineConfig} from 'vitest/config';

export default defineConfig({
test: {
onConsoleLog() {
return false;
},
},
});
46 changes: 0 additions & 46 deletions web-test-runner.config.js

This file was deleted.

0 comments on commit e018987

Please sign in to comment.