Skip to content

Commit 2eada09

Browse files
committed
chore: fix test coverage on github
1 parent 8be0c62 commit 2eada09

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
node-version: [ 18, 20, 22 ]
20+
node-version: [ 20, 22 ]
2121

2222
steps:
2323
- name: Checkout repository

test/jest.config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const isLocalEnv = fs.existsSync(path.join(__dirname, '.local'));
66
// https://jestjs.io/docs/en/configuration.html
77

88
module.exports = {
9+
rootDir: path.join(__dirname, '..'),
910
// All imported modules in your tests should be mocked automatically
1011
// automock: false,
1112

@@ -25,7 +26,7 @@ module.exports = {
2526
// collectCoverage: false,
2627

2728
// An array of glob patterns indicating a set of files for which coverage information should be collected
28-
collectCoverageFrom: ['../src/**/*.js'],
29+
collectCoverageFrom: ['<rootDir>/src/**/*.js'],
2930

3031
// The directory where Jest should output its coverage files
3132
// coverageDirectory: null,
@@ -35,7 +36,7 @@ module.exports = {
3536

3637
// Indicates which provider should be used to instrument code for coverage.
3738
// Allowed values are babel (default) or v8.
38-
// coverageProvider: 'babel',
39+
coverageProvider: 'v8',
3940

4041
// A list of reporter names that Jest uses when writing coverage reports
4142
// coverageReporters: [
@@ -105,7 +106,9 @@ module.exports = {
105106
// ],
106107

107108
// A map from regular expressions to module names that allow to stub out resources with a single module
108-
// moduleNameMapper: {},
109+
moduleNameMapper: {
110+
'^@test/pug-plugin$': '<rootDir>/src/index.js',
111+
},
109112

110113
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
111114
// modulePathIgnorePatterns: [],

0 commit comments

Comments
 (0)