Skip to content
Merged
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
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"sort-imports": 0,
"import/order": [2, {
"groups": ["type", "builtin", "external", "internal", "parent", "sibling", "index", "object"],
"alphabetize": { "order": "asc", "caseInsensitive": true },
}]
"alphabetize": { "order": "asc", "caseInsensitive": true }
}],
"@typescript-eslint/no-non-null-assertion": "off"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@technote-space/github-action-test-helper",
"version": "0.9.2",
"version": "0.9.3",
"description": "Test helper for GitHub Actions.",
"keywords": [
"github",
Expand Down
6 changes: 3 additions & 3 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const spyOnExportVariable = (): SpyInstance => vi.spyOn(core, 'expor
export const exportVariableCalledWith = (spyOnMock: SpyInstance, pairs: { name: string, val: any }[]): void => {
expect(spyOnMock).toBeCalledTimes(pairs.length);
pairs.forEach(({ name, val }, index) => {
expect(spyOnMock.mock.calls[index][0]).toBe(name);
expect(spyOnMock.mock.calls[index][1]).toEqual(val);
expect(spyOnMock.mock.calls[index]![0]).toBe(name);
expect(spyOnMock.mock.calls[index]![1]).toEqual(val);
});
};

Expand All @@ -19,6 +19,6 @@ export const spyOnAddPath = (): SpyInstance => vi.spyOn(core, 'addPath').mo
export const addPathCalledWith = (spyOnMock: SpyInstance, paths: string[]): void => {
expect(spyOnMock).toBeCalledTimes(paths.length);
paths.forEach((path, index) => {
expect(spyOnMock.mock.calls[index][0]).toBe(path);
expect(spyOnMock.mock.calls[index]![0]).toBe(path);
});
};
12 changes: 6 additions & 6 deletions src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ describe('testChildProcess, setChildProcessParams', () => {
]);
expect(callback).toBeCalledTimes(2);
expect(callback.mock.calls[0]).toHaveLength(3);
expect(callback.mock.calls[0][0]).toEqual(new Error('err1'));
expect(callback.mock.calls[0][1]).toBe('stdout1');
expect(callback.mock.calls[0][2]).toBe('stderr1');
expect(callback.mock.calls[0]![0]).toEqual(new Error('err1'));
expect(callback.mock.calls[0]![1]).toBe('stdout1');
expect(callback.mock.calls[0]![2]).toBe('stderr1');
expect(callback.mock.calls[1]).toHaveLength(3);
expect(callback.mock.calls[1][0]).toEqual(new Error('err2'));
expect(callback.mock.calls[1][1]).toBe('stdout2');
expect(callback.mock.calls[1][2]).toBe('stderr2');
expect(callback.mock.calls[1]![0]).toEqual(new Error('err2'));
expect(callback.mock.calls[1]![1]).toBe('stdout2');
expect(callback.mock.calls[1]![2]).toBe('stderr2');
});

it('should set mock params function 2', async() => {
Expand Down
12 changes: 6 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const testFs = (defaultExists = false): (boolean) => void => {
// eslint-disable-next-line no-magic-numbers
const result = count < existsData.length ? existsData[count] : existsData[existsData.length - 1];
count++;
return result;
return result!;
}));
};
const clearMock = (): void => {
Expand Down Expand Up @@ -129,7 +129,7 @@ export const spyOnStdout = (): SpyInstance => global.mockStdout.write;
export const stdoutCalledWith = (spyOnMock: SpyInstance, messages: string[]): void => {
expect(spyOnMock).toBeCalledTimes(messages.length);
messages.forEach((message, index) => {
expect(spyOnMock.mock.calls[index][0]).toBe(message + EOL);
expect(spyOnMock.mock.calls[index]![0]).toBe(message + EOL);
});
};
export const stdoutContains = (spyOnMock: SpyInstance, messages: string[]): void => {
Expand All @@ -146,13 +146,13 @@ export const execCalledWith = (spyOnMock: SpyInstance, messages: (string | any[
expect(spyOnMock).toBeCalledTimes(messages.length);
messages.forEach((message, index) => {
if (typeof message === 'string') {
expect(spyOnMock.mock.calls[index][0]).toBe(message);
expect(spyOnMock.mock.calls[index]![0]).toBe(message);
} else {
message.forEach((message, index2) => {
if (typeof spyOnMock.mock.calls[index][index2] === 'object') {
expect(spyOnMock.mock.calls[index][index2]).toEqual(message);
if (typeof spyOnMock.mock.calls[index]![index2] === 'object') {
expect(spyOnMock.mock.calls[index]![index2]).toEqual(message);
} else {
expect(spyOnMock.mock.calls[index][index2]).toBe(message);
expect(spyOnMock.mock.calls[index]![index2]).toBe(message);
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"es2020"
],
"noPropertyAccessFromIndexSignature": false,
"noImplicitAny": false,
"strictNullChecks": false
"noImplicitAny": false
},
"include": [
"src"
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
mockReset: true,
restoreMocks: true,
coverage: {
reporter: ['html', 'lcov'],
reporter: ['html', 'lcov', 'text'],
},
},
});