From 36162cf67b75954bdd74ad78c78132d16a2bd01f Mon Sep 17 00:00:00 2001 From: Ratson Date: Sat, 21 Aug 2021 23:34:45 +0800 Subject: [PATCH 1/4] Convert app template Jest config to TypeScript --- packages/generator/templates/app/README.md | 4 ++-- packages/generator/templates/app/jest.config.js | 3 --- packages/generator/templates/app/jest.config.ts | 7 +++++++ 3 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 packages/generator/templates/app/jest.config.js create mode 100644 packages/generator/templates/app/jest.config.ts diff --git a/packages/generator/templates/app/README.md b/packages/generator/templates/app/README.md index d89d92d3a7..e210f0d4b5 100644 --- a/packages/generator/templates/app/README.md +++ b/packages/generator/templates/app/README.md @@ -119,7 +119,7 @@ __name__ ├── README.md ├── babel.config.js ├── blitz.config.js -├── jest.config.js +├── jest.config.ts ├── package.json ├── tsconfig.json ├── types.d.ts @@ -147,7 +147,7 @@ These files are: - `blitz.config.js` is for advanced custom configuration of Blitz. It extends [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction). -- `jest.config.js` contains config for Jest tests. You can [customize it if needed](https://jestjs.io/docs/en/configuration). +- `jest.config.ts` contains config for Jest tests. You can [customize it if needed](https://jestjs.io/docs/en/configuration). You can read more about it in the [File Structure](https://blitzjs.com/docs/file-structure) section of the documentation. diff --git a/packages/generator/templates/app/jest.config.js b/packages/generator/templates/app/jest.config.js deleted file mode 100644 index 297905551f..0000000000 --- a/packages/generator/templates/app/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - preset: "blitz", -} diff --git a/packages/generator/templates/app/jest.config.ts b/packages/generator/templates/app/jest.config.ts new file mode 100644 index 0000000000..30fe3fc967 --- /dev/null +++ b/packages/generator/templates/app/jest.config.ts @@ -0,0 +1,7 @@ +import type { Config } from "@jest/types" + +const config: Config.InitialOptions = { + preset: "blitz", +} + +export default config From 21a79ff349ab860a2666b92500552255e07734a5 Mon Sep 17 00:00:00 2001 From: Ratson Date: Fri, 27 Aug 2021 22:44:14 +0800 Subject: [PATCH 2/4] Add config for JS users --- packages/generator/src/generators/app-generator.ts | 4 ++-- packages/generator/templates/app/jest.config.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 packages/generator/templates/app/jest.config.js diff --git a/packages/generator/src/generators/app-generator.ts b/packages/generator/src/generators/app-generator.ts index 83f032b03b..4f98334184 100644 --- a/packages/generator/src/generators/app-generator.ts +++ b/packages/generator/src/generators/app-generator.ts @@ -31,9 +31,9 @@ export class AppGenerator extends Generator { filesToIgnore() { if (!this.options.useTs) { - return ["tsconfig.json", "blitz-env.d.ts"] + return ["tsconfig.json", "blitz-env.d.ts", "jest.config.ts"] } - return ["jsconfig.json"] + return ["jsconfig.json", "jest.config.js"] } async getTemplateValues() { diff --git a/packages/generator/templates/app/jest.config.js b/packages/generator/templates/app/jest.config.js new file mode 100644 index 0000000000..297905551f --- /dev/null +++ b/packages/generator/templates/app/jest.config.js @@ -0,0 +1,3 @@ +module.exports = { + preset: "blitz", +} From 94fabee590857ef06dce99d5dab9a8adf919836b Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Mon, 30 Aug 2021 18:13:20 -0500 Subject: [PATCH 3/4] Update packages/generator/templates/app/README.md --- packages/generator/templates/app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/generator/templates/app/README.md b/packages/generator/templates/app/README.md index e210f0d4b5..7402dc90bc 100644 --- a/packages/generator/templates/app/README.md +++ b/packages/generator/templates/app/README.md @@ -119,7 +119,7 @@ __name__ ├── README.md ├── babel.config.js ├── blitz.config.js -├── jest.config.ts +├── jest.config.js ├── package.json ├── tsconfig.json ├── types.d.ts From cb70ce446458133b0f70ecab1aaa7a9f5b4b83ee Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Mon, 30 Aug 2021 18:14:00 -0500 Subject: [PATCH 4/4] Update packages/generator/templates/app/README.md --- packages/generator/templates/app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/generator/templates/app/README.md b/packages/generator/templates/app/README.md index 7402dc90bc..d89d92d3a7 100644 --- a/packages/generator/templates/app/README.md +++ b/packages/generator/templates/app/README.md @@ -147,7 +147,7 @@ These files are: - `blitz.config.js` is for advanced custom configuration of Blitz. It extends [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction). -- `jest.config.ts` contains config for Jest tests. You can [customize it if needed](https://jestjs.io/docs/en/configuration). +- `jest.config.js` contains config for Jest tests. You can [customize it if needed](https://jestjs.io/docs/en/configuration). You can read more about it in the [File Structure](https://blitzjs.com/docs/file-structure) section of the documentation.