@reporters/github 1.7.0 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('node:path');
4
+ const { fileURLToPath } = require('node:url');
4
5
  const util = require('node:util');
5
6
  const { EOL } = require('node:os');
6
7
  const core = require('@actions/core');
@@ -12,11 +13,14 @@ const stack = new StackUtils({ cwd: WORKSPACE, internals: StackUtils.nodeInterna
12
13
 
13
14
  const isFile = (name) => name?.startsWith(WORKSPACE);
14
15
 
15
- const getRelativeFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE, require.resolve(name) ?? '') : null);
16
+ const getRelativeFilePath = (name) => (isFile(name) ? path.relative(WORKSPACE, name) : null);
16
17
 
17
18
  function getFilePath(fileName) {
18
19
  if (fileName.startsWith('file://')) {
19
- return getRelativeFilePath(new URL(fileName).pathname);
20
+ return getRelativeFilePath(fileURLToPath(fileName));
21
+ }
22
+ if (!path.isAbsolute(fileName)) {
23
+ return getRelativeFilePath(path.resolve(fileName) ?? '');
20
24
  }
21
25
  return getRelativeFilePath(fileName);
22
26
  }
@@ -101,7 +105,7 @@ module.exports = async function githubReporter(source) {
101
105
  break;
102
106
  }
103
107
  }
104
- const formatedDiagnostics = diagnostics.map((d) => {
108
+ const formattedDiagnostics = diagnostics.map((d) => {
105
109
  const [key, ...rest] = d.split(' ');
106
110
  const value = rest.join(' ');
107
111
  return [
@@ -109,14 +113,14 @@ module.exports = async function githubReporter(source) {
109
113
  DIAGNOSTIC_VALUES[key] ? DIAGNOSTIC_VALUES[key](value) : value,
110
114
  ];
111
115
  });
112
- core.startGroup(`Test results (${formatedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.pass)?.[1] ?? counter.pass} passed, ${formatedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.fail)?.[1] ?? counter.fail} failed)`);
113
- core.notice(formatedDiagnostics.map((d) => d.join(': ')).join(EOL));
116
+ core.startGroup(`Test results (${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.pass)?.[1] ?? counter.pass} passed, ${formattedDiagnostics.find(([key]) => key === DIAGNOSTIC_KEYS.fail)?.[1] ?? counter.fail} failed)`);
117
+ core.notice(formattedDiagnostics.map((d) => d.join(': ')).join(EOL));
114
118
  core.endGroup();
115
119
 
116
120
  if (process.env.GITHUB_STEP_SUMMARY) {
117
121
  await core.summary
118
122
  .addHeading('Test Results')
119
- .addTable(formatedDiagnostics)
123
+ .addTable(formattedDiagnostics)
120
124
  .write();
121
125
  }
122
126
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporters/github",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "A github actions reporter for `node:test`",
5
5
  "type": "commonjs",
6
6
  "keywords": [