Skip to content

Commit

Permalink
chore: cleanup project architecture
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Dec 21, 2022
1 parent 757d22c commit d738a26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ jobs:
run: yarn check:types
- id: test
name: Run tests
run: yarn test:cov
env:
NODE_NO_WARNINGS: 1
VITEST_SEGFAULT_RETRY: 3
run: yarn test:cov --segfault-retry=3
- id: pack
name: Pack project
run: yarn pack -o %s-%v.tgz
Expand All @@ -89,17 +86,14 @@ jobs:
- id: package-version
name: Get package version
run: echo "result=$(jq .version package.json -r)" >> $GITHUB_OUTPUT
- id: test-archive
name: Archive code coverage results
- id: coverage
name: Archive coverage report
uses: actions/upload-artifact@v3.1.1
with:
name: |
${{ format('@{0}-{1}-{2}-coverage', github.repository_owner, github.event.repository.name, steps.package-version.outputs.result) }}
path: |
coverage
!coverage/tmp/
!coverage/lcov.info
- id: package-archive
${{ format('@{0}-{1}-{2}-lcov.info', github.repository_owner, github.event.repository.name, steps.package-version.outputs.result) }}
path: coverage/lcov.info
- id: archive
name: Archive production artifacts
uses: actions/upload-artifact@v3.1.1
with:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![module type: esm](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)
[![license](https://img.shields.io/github/license/flex-development/import-regex.svg)](LICENSE.md)
[![conventional commits](https://img.shields.io/badge/-conventional%20commits-fe5196?logo=conventional-commits&logoColor=ffffff)](https://conventionalcommits.org/)
[![github actions](http://img.shields.io/badge/-github%20actions-2088ff?style=flat&logo=github-actions&logoColor=ffffff)](https://github.com/features/actions)
[![typescript](https://img.shields.io/badge/-typescript-3178c6?logo=typescript&logoColor=ffffff)](https://typescriptlang.org/)
[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat&logo=vitest&logoColor=ffffff)](https://vitest.dev/)
[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat&logo=yarn&logoColor=ffffff)](https://yarnpkg.com/)
Expand Down
27 changes: 4 additions & 23 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,13 @@ import { BaseSequencer } from 'vitest/node'
* @const {UserConfigExport} config
*/
const config: UserConfigExport = defineConfig((): UserConfig => {
/**
* Absolute path to [experimental loader for Node.js][1].
*
* [1]: https://nodejs.org/docs/latest-v16.x/api/esm.html#loaders
*
* @const {string} NODE_LOADER_PATH
*/
const NODE_LOADER_PATH: string = path.resolve('loader.mjs')

/**
* Absolute path to tsconfig file.
*
* @const {string} TSCONFIG_PATH
*/
const TSCONFIG_PATH: string = path.resolve('tsconfig.json')

return {
define: {
'import.meta.env.CI': JSON.stringify(ci),
'import.meta.env.NODE_ENV': JSON.stringify(NodeEnv.TEST),
'process.env.NODE_OPTIONS': JSON.stringify(`--loader=${NODE_LOADER_PATH}`)
'import.meta.env.NODE_ENV': JSON.stringify(NodeEnv.TEST)
},
mode: NodeEnv.TEST,
plugins: [tsconfigpaths({ projects: [TSCONFIG_PATH] })],
plugins: [tsconfigpaths({ projects: [path.resolve('tsconfig.json')] })],
test: {
allowOnly: !ci,
clearMocks: true,
Expand All @@ -55,7 +38,7 @@ const config: UserConfigExport = defineConfig((): UserConfig => {
exclude: ['**/__mocks__/**', '**/__tests__/**', '**/index.ts'],
extension: ['.ts'],
include: ['src'],
reporter: ['json-summary', 'lcov', 'text'],
reporter: [ci ? 'lcovonly' : 'lcov', 'text'],
reportsDirectory: './coverage',
skipFull: false
},
Expand All @@ -68,9 +51,7 @@ const config: UserConfigExport = defineConfig((): UserConfig => {
include: ['**/__tests__/*.spec.ts', '**/__tests__/*.spec-d.ts'],
isolate: true,
mockReset: true,
outputFile: {
json: './__tests__/report.json'
},
outputFile: { json: './__tests__/report.json' },
passWithNoTests: true,
reporters: [
'json',
Expand Down

0 comments on commit d738a26

Please sign in to comment.