-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vitest): add @suspensive/vitest generating named config automati…
…cally by packageJson.name (#131) * feat(vitest): add @suspensive/vitest generating named config automatically by packageJson.name * Update packages/react/vitest.config.ts Co-authored-by: 박찬혁 <[email protected]> * ci(.github/workflows): update * Create dry-phones-applaud.md --------- Co-authored-by: 박찬혁 <[email protected]>
- Loading branch information
Showing
13 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@suspensive/react-query": patch | ||
"@suspensive/react": patch | ||
--- | ||
|
||
feat(vitest): add @suspensive/vitest generating named config automatically by packageJson.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
extends: ['@suspensive/eslint-config-ts'], | ||
ignorePatterns: ['*.js*', 'dist', 'coverage'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "@suspensive/vitest", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"lint": "eslint .", | ||
"prepack": "pnpm build", | ||
"type:check": "tsc --noEmit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import fs from 'fs' | ||
import path, { dirname } from 'path' | ||
import { UserConfig } from 'vitest/config' | ||
|
||
export const forPackage = (userConfig?: UserConfig): UserConfig => { | ||
const packageJsonPath = path.resolve(dirname('.'), 'package.json') | ||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) | ||
|
||
return { | ||
...userConfig, | ||
test: { | ||
name: packageJson.name, | ||
dir: './src', | ||
watch: false, | ||
environment: 'jsdom', | ||
globals: true, | ||
setupFiles: './test.setup.ts', | ||
coverage: { | ||
provider: 'v8', | ||
...userConfig?.test?.coverage, | ||
}, | ||
...userConfig?.test, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "@suspensive/tsconfig/base.json", | ||
"include": ["./src"], | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
import { forPackage } from '@suspensive/vitest' | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
name: '@suspensive/react-query', | ||
dir: './src', | ||
watch: false, | ||
environment: 'jsdom', | ||
globals: true, | ||
setupFiles: './test.setup.ts', | ||
coverage: { provider: 'v8' }, | ||
}, | ||
}) | ||
export default defineConfig(forPackage()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
import { forPackage } from '@suspensive/vitest' | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
name: '@suspensive/react', | ||
dir: './src', | ||
watch: false, | ||
environment: 'jsdom', | ||
globals: true, | ||
setupFiles: './test.setup.ts', | ||
coverage: { provider: 'v8' }, | ||
}, | ||
}) | ||
export default defineConfig(forPackage()) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.