diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2404c7e..d0b7a1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: diff --git a/README.md b/README.md index 5f8c0d5..9f8a72e 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/vitest.config.ts b/vitest.config.ts index 8e91d0c..e1d95e5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -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, @@ -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 }, @@ -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',