Skip to content

Commit

Permalink
chore: Migrate from jest to vitest (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldowseza authored Nov 27, 2024
1 parent 0a7a25d commit 236c167
Show file tree
Hide file tree
Showing 8 changed files with 3,778 additions and 9,561 deletions.
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.

13,284 changes: 3,752 additions & 9,532 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,27 @@
"build": "node postcss.js && tsc",
"postbuild": "cp dark-mode-utils.css package.json THIRD-PARTY-LICENSES.txt LICENSE README.md lib",
"lint": "eslint .",
"test": "jest --coverage"
"test": "vitest --run"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@vitest/coverage-istanbul": "^2.1.6",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-header": "3.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-unicorn": "^34.0.1",
"husky": "^9.0.11",
"jest": "^27.4.7",
"lint-staged": "^13.2.1",
"normalize.css": "^8.0.1",
"postcss": "^8.4.31",
"postcss-import": "^14.0.2",
"postcss-url": "^10.1.3",
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"typescript": "^4.5.5",
"vitest": "^2.1.6"
},
"lint-staged": {
"*.{ts,js}": [
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/apply-mode.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { test, expect, beforeEach, afterEach } from 'vitest';
import { applyMode, Mode, applyDensity, Density } from '../index';

let originalClassName: string;
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/disable-motion.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { test, expect, beforeEach, afterEach } from 'vitest';
import { disableMotion } from '../index';

let originalClassName: string;
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import '@testing-library/jest-dom/extend-expect';
import { expect } from 'vitest';
import * as matchers from '@testing-library/jest-dom/matchers';

expect.extend(matchers);
10 changes: 0 additions & 10 deletions src/__tests__/tsconfig.json

This file was deleted.

16 changes: 16 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
environment: 'jsdom',
setupFiles: ['./src/__tests__/setup.ts'],
coverage: {
enabled: process.env.CI === 'true',
provider: 'istanbul',
include: ['src/**'],
exclude: ['**/debug-tools/**', '**/test/**'],
},
},
});

0 comments on commit 236c167

Please sign in to comment.