Skip to content

Commit

Permalink
fix(js): tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
robertIsaac committed Aug 14, 2024
1 parent 54f52bb commit 6a98430
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
13 changes: 9 additions & 4 deletions packages/js/src/executors/tsc/tsc.impl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import * as ts from 'typescript';
import { ExecutorContext, isDaemonEnabled, output } from '@nx/devkit';
import {
ExecutorContext,
isDaemonEnabled,
joinPathFragments,
output,
} from '@nx/devkit';
import type { TypeScriptCompilationOptions } from '@nx/workspace/src/utilities/typescript/compilation';
import { CopyAssetsHandler } from '../../utils/assets/copy-assets-handler';
import { checkDependencies } from '../../utils/check-dependencies';
Expand Down Expand Up @@ -41,11 +46,11 @@ export function createTypeScriptCompilationOptions(
context: ExecutorContext
): TypeScriptCompilationOptions {
return {
outputPath: normalizedOptions.outputPath,
outputPath: joinPathFragments(normalizedOptions.outputPath),
projectName: context.projectName,
projectRoot: normalizedOptions.projectRoot,
rootDir: normalizedOptions.rootDir,
tsConfig: normalizedOptions.tsConfig,
rootDir: joinPathFragments(normalizedOptions.rootDir),
tsConfig: joinPathFragments(normalizedOptions.tsConfig),
watch: normalizedOptions.watch,
deleteOutputPath: normalizedOptions.clean,
getCustomTransformers: getCustomTrasformersFactory(
Expand Down
5 changes: 4 additions & 1 deletion packages/js/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ async function addProject(tree: Tree, options: NormalizedSchema) {
}

if (options.publishable) {
const packageRoot = join(defaultOutputDirectory, '{projectRoot}');
const packageRoot = joinPathFragments(
defaultOutputDirectory,
'{projectRoot}'
);

projectConfiguration.targets ??= {};
projectConfiguration.targets['nx-release-publish'] = {
Expand Down
4 changes: 2 additions & 2 deletions packages/js/src/generators/release-version/release-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Valid values are: ${validReleaseVersionPrefixes
);
}

const packageJsonPath = join(packageRoot, 'package.json');
const packageJsonPath = joinPathFragments(packageRoot, 'package.json');
if (!tree.exists(packageJsonPath)) {
throw new Error(
`The project "${projectName}" does not have a package.json available at ${packageJsonPath}.
Expand Down Expand Up @@ -830,7 +830,7 @@ To fix this you will either need to add a package.json file at that location, or
`The project "${dependencyProjectName}" does not have a packageRoot available. Please report this issue on https://github.com/nrwl/nx`
);
}
const dependencyPackageJsonPath = join(
const dependencyPackageJsonPath = joinPathFragments(
dependencyPackageRoot,
'package.json'
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { join } from 'path';
import { resolveVersionSpec } from './resolve-version-spec';

describe('resolveVersionSpec()', () => {
Expand Down Expand Up @@ -67,7 +66,7 @@ describe('resolveVersionSpec()', () => {
'file:../projectB',
'/packages/projectB'
)
).toEqual(expect.stringContaining(join('/packages/projectB')));
).toEqual(expect.stringContaining('/packages/projectB'));
});

it('should work for a yarn classic style link reference', async () => {
Expand All @@ -78,6 +77,6 @@ describe('resolveVersionSpec()', () => {
'link:../projectB',
'/packages/projectB'
)
).toEqual(expect.stringContaining(join('/packages/projectB')));
).toEqual(expect.stringContaining('/packages/projectB'));
});
});

0 comments on commit 6a98430

Please sign in to comment.