Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Oct 3, 2020
1 parent bcdc12d commit acce8f7
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 85 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm test
- name: npm version && npm publish
uses: bcomnes/npm-bump@v2.0.1
with:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
"test": "nyc npm run _mocha",
"watch": "npm run _mocha -- --watch --growl",
"codecov": "nyc report -r lcovonly && codecov",
"prepublishOnly": "git push --follow-tags && gh-release -y",
"version": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md"
"version": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md",
"preversion": "npm test",
"postversion": "git push --follow-tags && gh-release -y"
},
"dependencies": {
"ansi-styles": "^4.2.1",
Expand Down
105 changes: 35 additions & 70 deletions test/argument-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,191 +31,156 @@ describe("[argument-placeholders]", () => {
describe("If arguments preceded by '--' are nothing, '{1}' should be empty:", () => {
it("Node API", () =>
nodeApi("test-task:dump {1}")
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {1}"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("npm-run-all command (only '--' exists)", () =>
runAll(["test-task:dump {1}", "--"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("run-s command", () =>
runSeq(["test-task:dump {1}"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("run-s command (only '--' exists)", () =>
runSeq(["test-task:dump {1}", "--"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("run-p command", () =>
runPar(["test-task:dump {1}"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))

it("run-p command (only '--' exists)", () =>
runPar(["test-task:dump {1}", "--"])
.then(() => assert(result() === "[]"))
)
.then(() => assert(result() === "[]")))
})

describe("'{1}' should be replaced by the 1st argument preceded by '--':", () => {
it("Node API", () =>
nodeApi("test-task:dump {1}", { arguments: ["1st", "2nd"] })
.then(() => assert(result() === "[\"1st\"]"))
)
.then(() => assert(result() === "[\"1st\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {1}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\"]"))
)
.then(() => assert(result() === "[\"1st\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {1}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\"]"))
)
.then(() => assert(result() === "[\"1st\"]")))

it("run-p command", () =>
runPar(["test-task:dump {1}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\"]"))
)
.then(() => assert(result() === "[\"1st\"]")))
})

describe("'{2}' should be replaced by the 2nd argument preceded by '--':", () => {
it("Node API", () =>
nodeApi("test-task:dump {2}", { arguments: ["1st", "2nd"] })
.then(() => assert(result() === "[\"2nd\"]"))
)
.then(() => assert(result() === "[\"2nd\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {2}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"2nd\"]"))
)
.then(() => assert(result() === "[\"2nd\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {2}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"2nd\"]"))
)
.then(() => assert(result() === "[\"2nd\"]")))

it("run-p command", () =>
runPar(["test-task:dump {2}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"2nd\"]"))
)
.then(() => assert(result() === "[\"2nd\"]")))
})

describe("'{@}' should be replaced by the every argument preceded by '--':", () => {
it("Node API", () =>
nodeApi("test-task:dump {@}", { arguments: ["1st", "2nd"] })
.then(() => assert(result() === "[\"1st\",\"2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {@}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {@}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\"]")))

it("run-p command", () =>
runPar(["test-task:dump {@}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\"]")))
})

describe("'{*}' should be replaced by the all arguments preceded by '--':", () => {
it("Node API", () =>
nodeApi("test-task:dump {*}", { arguments: ["1st", "2nd"] })
.then(() => assert(result() === "[\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st 2nd\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st 2nd\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st 2nd\"]")))

it("run-p command", () =>
runPar(["test-task:dump {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st 2nd\"]")))
})

describe("Every '{1}', '{2}', '{@}' and '{*}' should be replaced by the arguments preceded by '--':", () => {
it("Node API", () =>
nodeApi("test-task:dump {1} {2} {3} {@} {*}", { arguments: ["1st", "2nd"] })
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {1} {2} {3} {@} {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {1} {2} {3} {@} {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]")))

it("run-p command", () =>
runPar(["test-task:dump {1} {2} {3} {@} {*}", "--", "1st", "2nd"])
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]"))
)
.then(() => assert(result() === "[\"1st\",\"2nd\",\"1st\",\"2nd\",\"1st 2nd\"]")))
})

describe("'{1:-foo}' should be replaced by 'foo' if arguments are nothing:", () => {
it("Node API", () =>
nodeApi("test-task:dump {1:-foo} {1}")
.then(() => assert(result() === "[\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {1:-foo} {1}"])
.then(() => assert(result() === "[\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {1:-foo} {1}"])
.then(() => assert(result() === "[\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\"]")))

it("run-p command", () =>
runPar(["test-task:dump {1:-foo} {1}"])
.then(() => assert(result() === "[\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\"]")))
})

describe("'{1:=foo}' should be replaced by 'foo' and should affect following '{1}' if arguments are nothing:", () => {
it("Node API", () =>
nodeApi("test-task:dump {1:=foo} {1}")
.then(() => assert(result() === "[\"foo\",\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\",\"foo\"]")))

it("npm-run-all command", () =>
runAll(["test-task:dump {1:=foo} {1}"])
.then(() => assert(result() === "[\"foo\",\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\",\"foo\"]")))

it("run-s command", () =>
runSeq(["test-task:dump {1:=foo} {1}"])
.then(() => assert(result() === "[\"foo\",\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\",\"foo\"]")))

it("run-p command", () =>
runPar(["test-task:dump {1:=foo} {1}"])
.then(() => assert(result() === "[\"foo\",\"foo\"]"))
)
.then(() => assert(result() === "[\"foo\",\"foo\"]")))
})
})
8 changes: 3 additions & 5 deletions test/bin/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/
"use strict"

/*
* Run tests in parallel.
* This can reduce the spent time of tests to 1/3, but this is badly affecting to the timers in tests.
* I need more investigation.
*/
// Run tests in parallel.
// This can reduce the spent time of tests to 1/3, but this is badly affecting to the timers in tests.
// I need more investigation.

//------------------------------------------------------------------------------
// Requirements
Expand Down
3 changes: 1 addition & 2 deletions test/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ describe("[fail] it should fail", () => {
it("run-s command", () => shouldFail(runSeq(["test-task:abort"])))
it("run-p command", () => shouldFail(runPar(["test-task:abort"])))
it("with correct exit code", () => nodeApi("test-task:abort").then(() =>
assert(false, "should fail")
).catch(err => {
assert(false, "should fail")).catch(err => {
// In NodeJS versions > 6, the child process correctly sends back
// the signal + code of null. In NodeJS versions <= 6, the child
// process does not set the signal, and sets the code to 1.
Expand Down
3 changes: 1 addition & 2 deletions test/mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ describe("[mixed] npm-run-all", () => {
"-p", "test-task:append b", "test-task:append c",
"-s", "test-task:append d", "test-task:append e",
"-r",
])
)
]))
})
9 changes: 6 additions & 3 deletions test/parallel.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ describe("[parallel]", () => {
result() === "abab" ||
result() === "baba" ||
result() === "abba" ||
result() === "baab")
result() === "baab"
)
})

it("npm-run-all command", async () => {
Expand All @@ -50,7 +51,8 @@ describe("[parallel]", () => {
result() === "abab" ||
result() === "baba" ||
result() === "abba" ||
result() === "baab")
result() === "baab"
)
})

it("run-p command", async () => {
Expand All @@ -59,7 +61,8 @@ describe("[parallel]", () => {
result() === "abab" ||
result() === "baba" ||
result() === "abba" ||
result() === "baab")
result() === "baab"
)
})
})

Expand Down

0 comments on commit acce8f7

Please sign in to comment.