GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — switch to ESM and update config/test wiring by crazy-max · Pull Request #961 · docker/actions-toolkit

switch to ESM and update config/test wiring #961

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.

Sign up for GitHub

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

Merged
crazy-max merged 5 commits into docker:main from crazy-max:esm
Jan 28, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

switch to ESM and update config/test wiring #961

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
faa5b5b
switch to ESM and update config/test wiring
crazy-max Jan 28, 2026
8a49a6e
remove the mapper entry for csv-parse in jest config
crazy-max Jan 28, 2026
3f7be6d
add ESM-safe os test helpers and tsconfig for tests
crazy-max Jan 28, 2026
9348f81
git: drop types/git and inline GitHub context type
crazy-max Jan 28, 2026
2617546
github: derive summary table types from core API
crazy-max Jan 28, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
add ESM-safe os test helpers and tsconfig for tests
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max
crazy-max committed Jan 28, 2026
commit 3f7be6d97d121ef2bdaf3e9135a3082a1c285c20

There are no files selected for viewing

30 changes: 30 additions & 0 deletions 30 __tests__/.helpers/os.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2025 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {jest} from '@jest/globals';
import os from 'os';

export const mockPlatform = (platform: NodeJS.Platform) => {
return jest.spyOn(os, 'platform').mockImplementation(() => platform);
};

export const mockArch = (arch: string) => {
return jest.spyOn(os, 'arch').mockImplementation(() => arch);
};

export const mockHomedir = (dir: string) => {
return jest.spyOn(os, 'homedir').mockImplementation(() => dir);
};
9 changes: 5 additions & 4 deletions 9 __tests__/buildx/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import {describe, expect, it, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install} from '../../src/buildx/install';

Expand Down Expand Up @@ -85,8 +86,8 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires buildx for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const install = new Install();
const buildxBin = await install.download('latest');
expect(fs.existsSync(buildxBin)).toBe(true);
Expand Down
9 changes: 5 additions & 4 deletions 9 __tests__/compose/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import {describe, expect, it, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install} from '../../src/compose/install';

Expand Down Expand Up @@ -85,8 +86,8 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires compose for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const install = new Install();
const composeBin = await install.download('latest');
expect(fs.existsSync(composeBin)).toBe(true);
Expand Down
9 changes: 5 additions & 4 deletions 9 __tests__/cosign/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import {describe, expect, it, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install} from '../../src/cosign/install';

Expand Down Expand Up @@ -80,8 +81,8 @@ describe('download', () => {
['linux', 'arm64']
])(
'acquires undock for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const install = new Install();
const cosignBin = await install.download({
version: 'latest'
Expand Down
5 changes: 3 additions & 2 deletions 5 __tests__/docker/docker.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import * as io from '@actions/io';
import osm = require('os');
import * as rimraf from 'rimraf';

import {mockHomedir} from '../.helpers/os';

import {Docker} from '../../src/docker/docker';

import {ConfigFile} from '../../src/types/docker/docker';
Expand All @@ -47,7 +48,7 @@ describe('configDir', () => {
});
it('returns default', async () => {
process.env.DOCKER_CONFIG = '';
jest.spyOn(osm, 'homedir').mockImplementation(() => path.join('/tmp', 'home'));
mockHomedir(path.join('/tmp', 'home'));
expect(Docker.configDir).toEqual(path.join('/tmp', 'home', '.docker'));
});
it('returns from env', async () => {
Expand Down
7 changes: 4 additions & 3 deletions 7 __tests__/docker/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install';

Expand Down Expand Up @@ -60,8 +61,8 @@ describe('download', () => {
[image('27.3.1'), 'win32'],
])(
'acquires %p of docker (%s)', async (source, platformOS) => {
jest.spyOn(osm, 'platform').mockImplementation(() => platformOS as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => 'x64');
mockPlatform(platformOS as NodeJS.Platform);
mockArch('x64');
const install = new Install({
source: source,
runDir: tmpDir
Expand Down
9 changes: 5 additions & 4 deletions 9 __tests__/oci/oci.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {afterEach, describe, expect, jest, test} from '@jest/globals';
import {afterEach, describe, expect, test} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {OCI} from '../../src/oci/oci';

Expand All @@ -44,8 +45,8 @@ describe('defaultPlatform', () => {
['linux', 'ppc64', {architecture: 'ppc64le', os: 'linux'}],
['linux', 's390x', {architecture: 's390x', os: 'linux'}]
])('default platform for %s/%s', async (os: string, arch: string, expected: Platform) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const res = OCI.defaultPlatform();
expect(res).toEqual(expected);
});
Expand Down
9 changes: 5 additions & 4 deletions 9 __tests__/regclient/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import {describe, expect, it, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install} from '../../src/regclient/install';

Expand Down Expand Up @@ -75,8 +76,8 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires regclient for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const install = new Install();
const regclientBin = await install.download('latest');
expect(fs.existsSync(regclientBin)).toBe(true);
Expand Down
9 changes: 5 additions & 4 deletions 9 __tests__/undock/install.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
import {describe, expect, it, test, afterEach} from '@jest/globals';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as rimraf from 'rimraf';
import osm = require('os');

import {mockArch, mockPlatform} from '../.helpers/os';

import {Install} from '../../src/undock/install';

Expand Down Expand Up @@ -80,8 +81,8 @@ describe('download', () => {
['linux', 's390x'],
])(
'acquires undock for %s/%s', async (os, arch) => {
jest.spyOn(osm, 'platform').mockImplementation(() => os as NodeJS.Platform);
jest.spyOn(osm, 'arch').mockImplementation(() => arch);
mockPlatform(os as NodeJS.Platform);
mockArch(arch);
const install = new Install();
const undockBin = await install.download('latest');
expect(fs.existsSync(undockBin)).toBe(true);
Expand Down
3 changes: 2 additions & 1 deletion 3 jest.config.cjs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module.exports = {
'^.+\\.ts$': [
'ts-jest',
{
useESM: true
useESM: true,
tsconfig: '<rootDir>/tsconfig.test.json'
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion 3 jest.config.itg.cjs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module.exports = {
'^.+\\.ts$': [
'ts-jest',
{
useESM: true
useESM: true,
tsconfig: '<rootDir>/tsconfig.test.json'
}
]
},
Expand Down
15 changes: 15 additions & 0 deletions 15 tsconfig.test.json
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"noEmit": true
},
"include": [
"src/**/*.ts",
"__tests__/**/*.ts"
],
"exclude": [
"lib",
"node_modules"
]
}
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402809 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.