Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arcatdmz/nextjs-with-jest-typescript
A very simple example of Next.js-based website with Jest tests, all written in TypeScript
https://github.com/arcatdmz/nextjs-with-jest-typescript
css-modules jest nextjs typescript
Last synced: 25 days ago
JSON representation
A very simple example of Next.js-based website with Jest tests, all written in TypeScript
- Host: GitHub
- URL: https://github.com/arcatdmz/nextjs-with-jest-typescript
- Owner: arcatdmz
- License: mit
- Created: 2019-01-18T15:58:13.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2021-09-23T17:52:58.000Z (about 3 years ago)
- Last Synced: 2024-10-01T03:05:38.289Z (about 1 month ago)
- Topics: css-modules, jest, nextjs, typescript
- Language: TypeScript
- Size: 405 KB
- Stars: 75
- Watchers: 3
- Forks: 27
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nextjs-with-jest-typescript
A very simple example of Next.js-based website with Jest tests, all written in TypeScript.
## install
```sh
$ yarn install
```## test
```sh
$ yarn test
yarn run v1.22.5
$ jest
PASS __tests__/index.test.tsx
With Enzyme
√ App shows "A simple example repo" in atag (7 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 2.893 s, estimated 4 s
Ran all test suites.
Done in 4.09s.
```## code
- `package.json/jest`: use `ts-jest` to test TypeScript files; use mocks for imported CSS/LESS files; use TypeScript compiler to handle both TS/JS files
- `jest.setup.ts`: use `enzyme` to test with [jQuery-like APIs](https://github.com/airbnb/enzyme#readme)
- `tsconfig.jest.json`: handles JSX transformation by `ts-jest` during the test## see also
https://github.com/vercel/next.js/tree/master/examples/with-typescript-eslint-jest
- does not use CSS files
- uses `babel-jest` instead of `ts-jest`---
https://github.com/arcatdmz/nextjs-with-jest-typescript
## Issues
- npm install issue resolved - refer - https://github.com/arcatdmz/nextjs-with-jest-typescript/issues/3