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
12 changes: 9 additions & 3 deletions e2e/nx/src/nxw.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
readJson,
readFile,
} from '@nx/e2e-utils';
import { bold } from 'chalk';
import { styleText } from 'node:util';

describe('nx wrapper / .nx installation', () => {
let runNxWrapper: ReturnType<typeof newWrappedNxWorkspace>;
Expand Down Expand Up @@ -85,8 +85,14 @@ describe('nx wrapper / .nx installation', () => {
installedPluginEnd
);

expect(installedPluginLines.some((x) => x.includes(`${bold('nx')}`)));
expect(installedPluginLines.some((x) => x.includes(`${bold('@nx/js')}`)));
expect(
installedPluginLines.some((x) => x.includes(`${styleText('bold', 'nx')}`))
);
Comment on lines +88 to +90
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expect statement is missing an assertion matcher (e.g., .toBeTruthy() or .toBe(true)). This causes the test to pass regardless of the actual result, making it ineffective.

Fix:

expect(
  installedPluginLines.some((x) => x.includes(`${styleText('bold', 'nx')}`))
).toBeTruthy();
Suggested change
expect(
installedPluginLines.some((x) => x.includes(`${styleText('bold', 'nx')}`))
);
expect(
installedPluginLines.some((x) => x.includes(`${styleText('bold', 'nx')}`))
).toBeTruthy();

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

expect(
installedPluginLines.some((x) =>
x.includes(`${styleText('bold', '@nx/js')}`)
)
);

output = runNxWrapper('list @nx/js');
expect(output).toContain('Capabilities in @nx/js');
Expand Down
26 changes: 16 additions & 10 deletions e2e/utils/log-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as chalk from 'chalk';
import { styleText } from 'node:util';

export const E2E_LOG_PREFIX = `${chalk.reset.inverse.bold.keyword('orange')(
' E2E '
const orangeColor = (text) => `\x1b[38;5;214m${text}\x1b[39m`;

export const E2E_LOG_PREFIX = `${styleText(
['reset', 'inverse', 'bold'],
orangeColor(' E2E ')
)}`;

export function e2eConsoleLogger(message: string, body?: string) {
Expand All @@ -14,22 +17,25 @@ export function e2eConsoleLogger(message: string, body?: string) {
}

export function logInfo(title: string, body?: string) {
const message = `${chalk.reset.inverse.bold.white(
const message = `${styleText(
['reset', 'inverse', 'bold', 'white'],
' INFO '
)} ${chalk.bold.white(title)}`;
)} ${styleText(['bold', 'white'], title)}`;
return e2eConsoleLogger(message, body);
}

export function logError(title: string, body?: string) {
const message = `${chalk.reset.inverse.bold.red(' ERROR ')} ${chalk.bold.red(
title
)}`;
const message = `${styleText(
['reset', 'inverse', 'bold', 'red'],
' ERROR '
)} ${styleText(['bold', 'red'], title)}`;
return e2eConsoleLogger(message, body);
}

export function logSuccess(title: string, body?: string) {
const message = `${chalk.reset.inverse.bold.green(
const message = `${styleText(
['reset', 'inverse', 'bold', 'green'],
' SUCCESS '
)} ${chalk.bold.green(title)}`;
)} ${styleText(['bold', 'green'], title)}`;
return e2eConsoleLogger(message, body);
}
Loading