This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,920 additions
and
938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.eslint.json" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier", | ||
"prettier/@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/ban-ts-ignore": "off" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,74 @@ | ||
import {toolchain_args} from "../src/args"; | ||
import {morph} from "mock-env" | ||
import {sync as tempWriteSync} from "temp-write" | ||
import { getToolchainArgs } from "../src/args"; | ||
import { morph } from "mock-env"; | ||
import { sync as tempWriteSync } from "temp-write"; | ||
|
||
describe('actions-rs/toolchain', () => { | ||
it('Parses action input into toolchain options', async () => { | ||
let args = morph(() => { | ||
return toolchain_args("./rust-toolchain"); | ||
}, { | ||
'INPUT_TOOLCHAIN': 'nightly-2019-04-20', | ||
'INPUT_DEFAULT': 'false', | ||
'INPUT_OVERRIDE': 'true' | ||
}); | ||
describe("actions-rs/toolchain", () => { | ||
it("Parses action input into toolchain options", () => { | ||
const args = morph( | ||
() => { | ||
return getToolchainArgs("./rust-toolchain"); | ||
}, | ||
{ | ||
INPUT_TOOLCHAIN: "nightly-2019-04-20", | ||
INPUT_DEFAULT: "false", | ||
INPUT_OVERRIDE: "true", | ||
} | ||
); | ||
|
||
expect(args.name).toBe('nightly-2019-04-20'); | ||
expect(args.name).toBe("nightly-2019-04-20"); | ||
expect(args.default).toBe(false); | ||
expect(args.override).toBe(true); | ||
}); | ||
|
||
it('uses input variable if rust-toolchain file does not exist', function () { | ||
let args = morph(() => { | ||
return toolchain_args("./rust-toolchain"); | ||
}, { | ||
'INPUT_TOOLCHAIN': 'nightly', | ||
}); | ||
it("uses input variable if rust-toolchain file does not exist", function () { | ||
const args = morph( | ||
() => { | ||
return getToolchainArgs("./rust-toolchain"); | ||
}, | ||
{ | ||
INPUT_TOOLCHAIN: "nightly", | ||
} | ||
); | ||
|
||
expect(args.name).toBe("nightly") | ||
expect(args.name).toBe("nightly"); | ||
}); | ||
|
||
it('toolchain input is required if rust-toolchain does not exist', function () { | ||
expect(() => toolchain_args("./rust-toolchain")).toThrowError() | ||
it("toolchain input is required if rust-toolchain does not exist", function () { | ||
expect(() => getToolchainArgs("./rust-toolchain")).toThrowError(); | ||
}); | ||
|
||
it('prioritizes rust-toolchain file over input variable', function () { | ||
let rustToolchainFile = tempWriteSync("1.39.0"); | ||
it("prioritizes rust-toolchain file over input variable", function () { | ||
const rustToolchainFile = tempWriteSync("1.39.0"); | ||
|
||
let args = morph(() => { | ||
return toolchain_args(rustToolchainFile); | ||
}, { | ||
'INPUT_TOOLCHAIN': 'nightly', | ||
}); | ||
const args = morph( | ||
() => { | ||
return getToolchainArgs(rustToolchainFile); | ||
}, | ||
{ | ||
INPUT_TOOLCHAIN: "nightly", | ||
} | ||
); | ||
|
||
expect(args.name).toBe("nightly") | ||
expect(args.name).toBe("nightly"); | ||
}); | ||
|
||
it('uses rust-toolchain file if input does not exist', function () { | ||
let rustToolchainFile = tempWriteSync("1.39.0"); | ||
it("uses rust-toolchain file if input does not exist", function () { | ||
const rustToolchainFile = tempWriteSync("1.39.0"); | ||
|
||
let args = morph(() => { | ||
return toolchain_args(rustToolchainFile); | ||
const args = morph(() => { | ||
return getToolchainArgs(rustToolchainFile); | ||
}, {}); | ||
|
||
expect(args.name).toBe("1.39.0") | ||
expect(args.name).toBe("1.39.0"); | ||
}); | ||
|
||
it('trims content of the override file', function () { | ||
let rustToolchainFile = tempWriteSync("\n 1.39.0\n\n\n\n"); | ||
it("trims content of the override file", function () { | ||
const rustToolchainFile = tempWriteSync("\n 1.39.0\n\n\n\n"); | ||
|
||
let args = morph(() => { | ||
return toolchain_args(rustToolchainFile); | ||
const args = morph(() => { | ||
return getToolchainArgs(rustToolchainFile); | ||
}, {}); | ||
|
||
expect(args.name).toBe("1.39.0") | ||
expect(args.name).toBe("1.39.0"); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"clearMocks": true, | ||
"moduleFileExtensions": ["js", "ts"], | ||
"testEnvironment": "node", | ||
"testMatch": ["**/*.test.ts"], | ||
"testRunner": "jest-circus/runner", | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"verbose": true | ||
} |
Oops, something went wrong.