Skip to content

Commit

Permalink
[patch] try fixing tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Sep 11, 2024
1 parent 6898db7 commit be4bb1f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
12 changes: 9 additions & 3 deletions packages/docs/src/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import {ChalkInstance} from 'chalk';
import mri from 'mri';
import {basename, join} from 'node:path';
import {pathToFileURL} from 'node:url';
import type * as Typedoc from 'typedoc';

/** A virmator plugin for checking and generating documentation. */
Expand Down Expand Up @@ -160,9 +161,14 @@ export const virmatorDocsPlugin = defineVirmatorPlugin(
}

// dynamic imports are not branches
/* node:coverage ignore next 2 */
const config = (await import(join(packageDir, configs.docs.configs.typedoc.copyToPath)))
.typeDocConfig as Typedoc.TypeDocOptions;
/* node:coverage ignore next 7 */
const config = (
await import(
pathToFileURL(
join(packageDir, configs.docs.configs.typedoc.copyToPath),
).toString()
)
).typeDocConfig as Typedoc.TypeDocOptions;

await runTypedoc({
checkOnly,
Expand Down
5 changes: 4 additions & 1 deletion packages/frontend/src/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {defineVirmatorPlugin, NpmDepType, PackageType, VirmatorEnv} from '@virma
import mri from 'mri';
import {cp, rm} from 'node:fs/promises';
import {join, relative, resolve} from 'node:path';
import {pathToFileURL} from 'node:url';
import type {UserConfig} from 'vite';

/** A virmator plugin for running and building frontend packages. */
Expand Down Expand Up @@ -109,7 +110,9 @@ export const virmatorFrontendPlugin = defineVirmatorPlugin(
usedCommands.frontend?.subCommands.build || usedCommands.frontend?.subCommands.preview;
const configPath = args.config || configs.frontend.configs.vite.fullCopyToPath;

const viteConfig = await ((await import(configPath)).default as MaybePromise<UserConfig>);
const viteConfig = await ((
await import(pathToFileURL(configPath).toString())
).default as MaybePromise<UserConfig>);

const rootDir: string = viteConfig.root ? resolve(cwd, viteConfig.root) : cwd;
const outDir: string = resolve(rootDir, viteConfig.build?.outDir || 'dist');
Expand Down
2 changes: 1 addition & 1 deletion packages/init/configs/github/workflows/tests-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion packages/init/configs/github/workflows/tests-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
3 changes: 2 additions & 1 deletion packages/test/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {glob} from 'glob';
import mri from 'mri';
import {rm, writeFile} from 'node:fs/promises';
import {join, relative} from 'node:path';
import {pathToFileURL} from 'node:url';

/** A virmator plugin for running tests. */
export const virmatorTestPlugin = defineVirmatorPlugin(
Expand Down Expand Up @@ -282,7 +283,7 @@ export const virmatorTestPlugin = defineVirmatorPlugin(
configPath,
];

const webTestRunnerConfig = (await import(configPath))
const webTestRunnerConfig = (await import(pathToFileURL(configPath).toString()))
.default as Partial<TestRunnerConfig>;

const includeCoverage = usedCommands.test.subCommands.web.subCommands.coverage;
Expand Down

0 comments on commit be4bb1f

Please sign in to comment.