@reporters/github 1.1.0 → 1.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.1](https://github.com/MoLow/reporters/compare/github-v1.1.0...github-v1.1.1) (2023-02-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **github:** silent if not running on github actions ([#33](https://github.com/MoLow/reporters/issues/33)) ([a480454](https://github.com/MoLow/reporters/commit/a480454ac7ca0471744ec00b69a6c67a1d3c8ada))
9
+
3
10
  ## [1.1.0](https://github.com/MoLow/reporters/compare/github-v1.0.2...github-v1.1.0) (2023-02-02)
4
11
 
5
12
 
package/index.js CHANGED
@@ -33,6 +33,11 @@ const DIAGNOSTIC_VALUES = {
33
33
  };
34
34
 
35
35
  module.exports = async function githubReporter(source) {
36
+ if (!process.env.GITHUB_ACTIONS) {
37
+ // eslint-disable-next-line no-unused-vars
38
+ for await (const _ of source);
39
+ return;
40
+ }
36
41
  const counter = { pass: 0, fail: 0 };
37
42
  const diagnostics = [];
38
43
  for await (const event of source) {
@@ -80,8 +85,10 @@ module.exports = async function githubReporter(source) {
80
85
  core.notice(formatedDiagnostics.map((d) => d.join(': ')).join(EOL));
81
86
  core.endGroup();
82
87
 
83
- await core.summary
84
- .addHeading('Test Results')
85
- .addTable(formatedDiagnostics)
86
- .write();
88
+ if (process.env.GITHUB_STEP_SUMMARY) {
89
+ await core.summary
90
+ .addHeading('Test Results')
91
+ .addTable(formatedDiagnostics)
92
+ .write();
93
+ }
87
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporters/github",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A github actions reporter for `node:test`",
5
5
  "keywords": [
6
6
  "github actions",
@@ -14,7 +14,7 @@
14
14
  "stack-utils": "^2.0.6"
15
15
  },
16
16
  "scripts": {
17
- "test": "node --test-reporter=spec --test"
17
+ "test": "node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./index.js --test-reporter-destination=stdout --test"
18
18
  },
19
19
  "bugs": {
20
20
  "url": "https://github.com/MoLow/reporters/issues"
@@ -11,7 +11,7 @@ const GITHUB_STEP_SUMMARY = join(tmpdir(), 'github-actions-test-reporter');
11
11
  writeFileSync(GITHUB_STEP_SUMMARY, '');
12
12
 
13
13
  const child = spawnSync(process.execPath, ['--test-reporter', './index.js', '../../tests/example'], {
14
- env: { GITHUB_STEP_SUMMARY, GITHUB_WORKSPACE: path.resolve(__dirname, '../../../') },
14
+ env: { GITHUB_ACTIONS: true, GITHUB_STEP_SUMMARY, GITHUB_WORKSPACE: path.resolve(__dirname, '../../../') },
15
15
  });
16
16
 
17
17
  assert.strictEqual(child.stderr?.toString(), '');