Skip to content

Commit

Permalink
Merge pull request #85 from bcomnes/disable-npm-config-overrides
Browse files Browse the repository at this point in the history
Move support to node 16 and npm 8
  • Loading branch information
bcomnes authored Jun 11, 2022
2 parents 9a64a46 + 7d19dd4 commit 1b8e1c8
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true

env:
NODE_VERSION: 14
NODE_VERSION: 'lts/*'
FORCE_COLOR: 2

jobs:
Expand All @@ -29,7 +29,7 @@ jobs:
- run: git status # getting odd dirty repo errors during version debug info
- run: git diff
- name: npm version && npm publish
uses: bcomnes/npm-bump@v2
uses: bcomnes/npm-bump@v2.0.2
with:
git_email: bcomnes@gmail.com
git_username: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node: [14, 12]
os: [ubuntu-latest, windows-latest, macos-latest]
node: ['lts/*', 18]

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"docs"
],
"engines": {
"node": ">= 10"
"node": ">= 16",
"npm": ">= 8"
},
"scripts": {
"_mocha": "mocha --timeout 120000",
Expand Down
135 changes: 71 additions & 64 deletions test/package-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// Requirements
//------------------------------------------------------------------------------

const { execSync } = require("child_process")
const assert = require("assert").strict
const nodeApi = require("../lib")
const util = require("./lib/util")
Expand All @@ -28,81 +29,87 @@ describe("[package-config] it should have an ability to overwrite package's conf

beforeEach(removeResult)

it("Node API should address \"packageConfig\" option", async () => {
await nodeApi("test-task:package-config", { packageConfig: { "npm-run-all-test": { test: "OVERWRITTEN" } } })
assert(result() === "OVERWRITTEN")
})
const [major] = execSync("npm --version", { encoding: "utf8" }).trim().split(".")

it("Node API should address \"packageConfig\" option for multiple variables", async () => {
await nodeApi("test-task:package-config2", { packageConfig: { "npm-run-all-test": { test: "1", test2: "2", test3: "3" } } })
assert(result() === "1\n2\n3")
})
const supportsOverrides = major <= 6

describe("CLI commands should address \"--a:b=c\" style options", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
if (supportsOverrides) {
it("Node API should address \"packageConfig\" option", async () => {
await nodeApi("test-task:package-config", { packageConfig: { "npm-run-all-test": { test: "OVERWRITTEN" } } })
assert.equal(result(), "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
it("Node API should address \"packageConfig\" option for multiple variables", async () => {
await nodeApi("test-task:package-config2", { packageConfig: { "npm-run-all-test": { test: "1", test2: "2", test3: "3" } } })
assert.equal(result(), "1\n2\n3")
})

it("run-p command", async () => {
await runPar(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
describe("CLI commands should address \"--a:b=c\" style options", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-p command", async () => {
await runPar(["test-task:package-config", "--npm-run-all-test:test=OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})
})
})

describe("CLI commands should address \"--a:b=c\" style options for multiple variables", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert(result() === "1\n2\n3")
describe("CLI commands should address \"--a:b=c\" style options for multiple variables", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert.equal(result(), "1\n2\n3")
})

it("run-s command", async () => {
await runSeq(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert.equal(result(), "1\n2\n3")
})

it("run-p command", async () => {
await runPar(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert.equal(result(), "1\n2\n3")
})
})

it("run-s command", async () => {
await runSeq(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert(result() === "1\n2\n3")
describe("CLI commands should address \"--a:b c\" style options", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-p command", async () => {
await runPar(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})
})

it("run-p command", async () => {
await runPar(["test-task:package-config2", "--npm-run-all-test:test=1", "--npm-run-all-test:test2=2", "--npm-run-all-test:test3=3"])
assert(result() === "1\n2\n3")
describe("CLI commands should transfar overriting nested commands.", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})

it("run-p command", async () => {
await runPar(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert.equal(result(), "OVERWRITTEN")
})
})
})

describe("CLI commands should address \"--a:b c\" style options", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})

it("run-p command", async () => {
await runPar(["test-task:package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})
})

describe("CLI commands should transfar overriting nested commands.", () => {
it("npm-run-all command", async () => {
await runAll(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})

it("run-s command", async () => {
await runSeq(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})

it("run-p command", async () => {
await runPar(["test-task:nested-package-config", "--npm-run-all-test:test", "OVERWRITTEN"])
assert(result() === "OVERWRITTEN")
})
})
}
})

0 comments on commit 1b8e1c8

Please sign in to comment.