Skip to content

Commit 168a597

Browse files
authored
fix: dist/bin.js path (#322)
1 parent 5ff98de commit 168a597

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
33

44
name: Build and test
5-
on: push
5+
on: [push, pull_request]
66
jobs:
77
build-and-test:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
node: ["12", "14", "16"]
11+
node: ["16", "18", "20"]
1212
name: Build and test with Node ${{ matrix.node }}
1313
steps:
1414
- uses: actions/checkout@v3
@@ -19,7 +19,7 @@ jobs:
1919
- run: npm ci
2020
- run: npm run build
2121
# Have audit-ci run audit-ci to audit itself :)
22-
- run: node ./dist/audit-ci.js --config ./audit-ci.jsonc
22+
- run: node ./dist/bin.js --config ./audit-ci.jsonc
2323
- run: npm test
2424
- run: npm run lint
2525
- run: npm run format -- --check

test/npm7-auditer.spec.ts

+22-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NPMAuditReportV2 } from "audit-types";
22
import { expect } from "chai";
3+
import semver from "semver";
34
import Allowlist from "../lib/allowlist";
45
import { auditWithFullConfig, report } from "../lib/npm-auditer";
56
import {
@@ -29,6 +30,12 @@ const reportNpmNone = untypedReportNpmNone as unknown as NPMAuditReportV2.Audit;
2930
const reportNpmSkipDevelopment =
3031
untypedReportNpmSkipDevelopment as unknown as NPMAuditReportV2.Audit;
3132

33+
const nodeVersion = process.version;
34+
35+
function nodeVersionIsAtLeast(version: string) {
36+
return semver.gte(nodeVersion, version);
37+
}
38+
3239
function config(
3340
additions: Omit<Parameters<typeof baseConfig>[0], "package-manager">
3441
) {
@@ -391,20 +398,21 @@ describe("npm7-auditer", () => {
391398
done();
392399
});
393400
});
394-
it("fails with error code ECONNREFUSED on a live site with no registry", (done) => {
395-
auditWithFullConfig(
396-
config({
397-
directory: testDirectory("npm-low"),
398-
levels: { low: true },
399-
registry: "http://localhost",
400-
})
401-
)
402-
.catch((error) => {
403-
expect(error.message).to.include("ECONNREFUSED");
404-
done();
405-
})
406-
.catch((error) => done(error));
407-
});
401+
semver.lt(nodeVersion, "20.0.0") &&
402+
it("fails with error code ECONNREFUSED on a live site with no registry", (done) => {
403+
auditWithFullConfig(
404+
config({
405+
directory: testDirectory("npm-low"),
406+
levels: { low: true },
407+
registry: "http://localhost",
408+
})
409+
)
410+
.catch((error) => {
411+
expect(error.message).to.include("ECONNREFUSED");
412+
done();
413+
})
414+
.catch((error) => done(error));
415+
});
408416
it("reports summary with no vulnerabilities when critical devDependency and skip-dev is true", () => {
409417
const summary = report(
410418
reportNpmSkipDevelopment,

0 commit comments

Comments
 (0)