Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: node-ci

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x]
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Run linter
run: npm run lint

7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions appveyor.yml

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"node": ">=10"
},
"scripts": {
"pretest": "eslint src/*.js",
"lint": "eslint src/*.js",
"test": "ava --tap",
"posttest": "npm run lint",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
Expand Down
50 changes: 25 additions & 25 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const pkg = require("../package.json");
const sep = require("os").EOL;
const cwd = process.cwd();
const helpMessageOutput = fs
.readFileSync(path.join(__dirname, "fixtures", "help"), { encoding: "utf8" })
.readFileSync(path.resolve(__dirname, "fixtures", "help"), { encoding: "utf8" })
.replace(/\\n/, sep)
.trim();

Expand Down Expand Up @@ -258,7 +258,7 @@ if (!process.env.TRAVISTEST && !process.env.APPVEYOR) {
const stdinfile = tempfile();
const stdin = fs.createWriteStream(stdinfile);
const runner = exec(
`node ${path.join("src", "cli.js")} ${path.join(
`node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"clipboard"
Expand Down Expand Up @@ -308,7 +308,7 @@ const cli = ({ cmd, input = [], output, error }) => t => {
test.cb(
"should be able to pipe data from stdin",
cli({
cmd: `echo banana,peach,apple | node ${path.join(
cmd: `echo banana,peach,apple | node ${path.resolve(
"src",
"cli.js"
)} --stdin-tty=<%= stdin %> -s , --debug`,
Expand All @@ -320,7 +320,7 @@ test.cb(
test.cb(
"should not quote result args with white space if --unquoted option is given",
cli({
cmd: `node ${path.join("src", "cli.js")} "${path.join(
cmd: `node ${path.resolve("src", "cli.js")} "${path.resolve(
"test",
"fixtures",
"white space"
Expand All @@ -333,7 +333,7 @@ test.cb(
test.cb(
"should quote result args with white space",
cli({
cmd: `node ${path.join("src", "cli.js")} "${path.join(
cmd: `node ${path.resolve("src", "cli.js")} "${path.resolve(
"test",
"fixtures",
"white space"
Expand All @@ -346,7 +346,7 @@ test.cb(
test.cb(
"should display error if provided file is not found",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"inexistentfilename"
Expand All @@ -358,7 +358,7 @@ test.cb(
test.cb(
"should display version on --version",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -370,15 +370,15 @@ test.cb(
test.cb(
"should display help message on empty invocation",
cli({
cmd: `node ${path.join("src", "cli.js")}`,
cmd: `node ${path.resolve("src", "cli.js")}`,
output: helpMessageOutput
})
);

test.cb(
"should display help message on --help",
cli({
cmd: `node ${path.join("src", "cli.js")} --help`,
cmd: `node ${path.resolve("src", "cli.js")} --help`,
output: helpMessageOutput
})
);
Expand All @@ -387,7 +387,7 @@ test.cb(
"should run from cli using default platform separator",
process.platform === "win32"
? cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"crlf"
Expand All @@ -396,7 +396,7 @@ test.cb(
output: "a"
})
: cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -409,7 +409,7 @@ test.cb(
test.cb(
"should get valid paths if using -p option",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"files"
Expand All @@ -425,7 +425,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should read utf16 encode using --file-encoding option",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"utf16encode"
Expand All @@ -438,7 +438,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should read ascii encode using --file-encoding option",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"asciiencode"
Expand All @@ -452,7 +452,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able to use custom separators with --separator",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"test.csv"
Expand All @@ -465,7 +465,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should run in autocomplete mode from cli",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -478,7 +478,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should run using multiple from cli",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -491,7 +491,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should get valid results if using -0 (null char separator) option",
cli({
cmd: `find test/fixtures -print0 | node ${path.join(
cmd: `find test/fixtures -print0 | node ${path.resolve(
"src",
"cli.js"
)} -a -0 --stdin-tty=<%= stdin %> | xargs -0 cat`,
Expand All @@ -503,7 +503,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should run from cli using a weird separator",
cli({
cmd: `echo foo:™£:bar:™£:lorem:™£:ipsum:™£:dolor:™£:sit:™£:amet:™£:now | node ${path.join(
cmd: `echo foo:™£:bar:™£:lorem:™£:ipsum:™£:dolor:™£:sit:™£:amet:™£:now | node ${path.resolve(
"src",
"cli.js"
)} --stdin-tty=<%= stdin %> -s :™£:`,
Expand All @@ -515,7 +515,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able to specify a default selected option in a list",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -528,7 +528,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able to specify a list of default choices to select for multiple choices",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -541,7 +541,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able to use ---default-separator to split multiple default choices",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"simpletest"
Expand All @@ -554,7 +554,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able use --separator as the default separator to split multiple default choices",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"test.csv"
Expand All @@ -567,7 +567,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able override --separator with --default-separator to split multiple default choices",
cli({
cmd: `node ${path.join("src", "cli.js")} ${path.join(
cmd: `node ${path.resolve("src", "cli.js")} ${path.resolve(
"test",
"fixtures",
"test.csv"
Expand All @@ -580,7 +580,7 @@ if (!process.env.APPVEYOR) {
test.cb(
"should be able to use --input option",
cli({
cmd: `node ${path.join("src", "cli.js")} "${path.join(
cmd: `node ${path.resolve("src", "cli.js")} "${path.resolve(
"test",
"fixtures",
"white space"
Expand Down