Skip to content

Commit

Permalink
chore: Use vitest instead of jest (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Aug 16, 2023
1 parent ef5923e commit 8e9c948
Show file tree
Hide file tree
Showing 20 changed files with 617 additions and 1,485 deletions.
9 changes: 2 additions & 7 deletions action-src/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
"__snapshots__"
],
"useGitignore": true,
"ignoreWords": [
"EDITMSG",
"pollyjs"
],
"words": [
"outfile"
]
"ignoreWords": ["EDITMSG", "pollyjs"],
"words": ["lcov", "outfile"]
}
38 changes: 6 additions & 32 deletions action-src/fixtures/cspell.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
{
"version": "0.1",
"words": [
"camelcase",
"octokit",
"pollyjs",
"repos",
"shrinkwrap",
"streetsidesoftware"
],
"ignorePaths": [
"node_modules",
"action/",
"cspell.json",
"__recordings__",
"**/*.json"
],
"words": ["camelcase", "octokit", "pollyjs", "repos", "shrinkwrap", "streetsidesoftware"],
"ignorePaths": ["node_modules", "action/", "cspell.json", "__recordings__", "**/*.json"],
"overrides": [
{
"filename": "*.har",
"languageId": "json",
"dictionaries": [
"http",
"node",
"typescript"
],
"words": [
"etag",
"maxage",
"ratelimit",
"nosniff"
]
"dictionaries": ["http", "node", "typescript"],
"words": ["etag", "maxage", "ratelimit", "nosniff"]
}
],
"enableFiletypes": [
"shellscript"
],
"import": [
"../cspell.json"
]
"enableFiletypes": ["shellscript"],
"import": ["../cspell.json"]
}
11 changes: 0 additions & 11 deletions action-src/jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion action-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"prepublishOnly": "yarn build",
"smoke-test-push": "env-cmd -f ./fixtures/push.json node ./action/lib/main_root.js",
"smoke-test": "env-cmd -f ./fixtures/pull_request.json node ./action/lib/main_root.js",
"test": "jest"
"test": "vitest run"
},
"bin": {
"build": "./build.mjs"
Expand Down
7 changes: 4 additions & 3 deletions action-src/src/ActionParams.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActionParamsInput, applyDefaults, validateActionParams, __testing__ } from './ActionParams';
import { describe, expect, test, vi } from 'vitest';
import { ActionParamsInput, __testing__, applyDefaults, validateActionParams } from './ActionParams';

describe('ActionParams', () => {
test.each`
Expand All @@ -18,7 +19,7 @@ describe('ActionParams', () => {
${{ inline: 'swizzle' }} | ${'Invalid inline level (swizzle), must be one of (error, warning, none)'}
${{ strict: 'sure' }} | ${'Invalid strict setting, must be one of (true, false)'}
`('validateActionParams Errors $params', ({ params, expected }) => {
const logger = jest.fn();
const logger = vi.fn();
expect(() => validateActionParams(ap(params), logger)).toThrow();
expect(logger).toHaveBeenCalledWith(expected);
});
Expand All @@ -27,7 +28,7 @@ describe('ActionParams', () => {
params
${{ github_token: 'token' }}
`('validateActionParams $params', ({ params }) => {
const logger = jest.fn();
const logger = vi.fn();
expect(() => validateActionParams(ap(params), logger)).not.toThrow();
expect(logger).not.toHaveBeenCalled();
});
Expand Down
4 changes: 2 additions & 2 deletions action-src/src/ActionParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function validateInlineLevel(params: ActionParamsInput) {
const validateStrict = validateTrueFalse('strict', 'Invalid strict setting, must be one of (true, false)');
const validateIncrementalFilesOnly = validateTrueFalse(
'incremental_files_only',
'Invalid incremental_files_only setting, must be one of (true, false)'
'Invalid incremental_files_only setting, must be one of (true, false)',
);
const validateVerbose = validateTrueFalse('verbose', 'Invalid verbose setting, must be one of (true, false)');

Expand All @@ -114,7 +114,7 @@ function isInlineWorkflowCommand(cmd: InlineWorkflowCommand | string): cmd is In

export function validateActionParams(
params: ActionParamsInput | ActionParams,
logError: (msg: string) => void
logError: (msg: string) => void,
): asserts params is ActionParams {
const validations: ValidationFunction[] = [
validateToken,
Expand Down
Loading

0 comments on commit 8e9c948

Please sign in to comment.