Skip to content

Commit

Permalink
refactor: convert singular test file to ts, add test specific tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Coltin Kifer committed Sep 6, 2024
1 parent dc400ed commit 2e6a9ca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 0 additions & 3 deletions test/index.spec.jsx → test/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('Animate', () => {
expect(element).toHaveStyle({
opacity: 0,
});
done();
}, 700);
});

Expand All @@ -37,7 +36,6 @@ describe('Animate', () => {
expect(num).toEqual(0);
setTimeout(() => {
expect(num).toEqual(1);
done();
}, 700);
});

Expand Down Expand Up @@ -85,7 +83,6 @@ describe('Animate', () => {
setTimeout(() => {
expect(firstStatus).toEqual('yes');
expect(secondStatus).toEqual('yes');
done();
}, 1400);
});
});
14 changes: 14 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"jsx": "react",
"module": "commonjs",
"noEmit": true,
"noImplicitAny": false,
"skipLibCheck": true,
"target": "es6",
"types": ["vitest/globals"]
},
"include": ["./**/*", "../types.d.ts"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"types": ["vitest/globals"],
"allowJs": true
},
"include": ["./src/**/*", "types.d.ts"]
"include": ["./src/**/*"]
}
3 changes: 2 additions & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="vitest" />
// eslint-disable-next-line import/no-unresolved
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
Expand All @@ -10,7 +11,7 @@ export default defineConfig({
environment: 'jsdom',
globals: true,
setupFiles: ['test/vitest.setup.ts'],
exclude: ['react-smooth', 'node_modules', 'dist', '.idea', '.git', '.cache', 'build', 'scripts', '.stryker-tmp'],
exclude: ['node_modules', 'dist', '.idea', '.git', '.cache', 'build', 'scripts'],
coverage: {
provider: 'v8',
include: ['src', 'test'],
Expand Down

0 comments on commit 2e6a9ca

Please sign in to comment.