Skip to content

Commit

Permalink
Add case from #295
Browse files Browse the repository at this point in the history
  • Loading branch information
domsleee committed Oct 15, 2023
1 parent 0bb7c08 commit 1694b2a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 89 deletions.
8 changes: 8 additions & 0 deletions examples/examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Example tests', () => {
expect(true);
});

// #319
it(`test with
lf`, () => {
expect(true);
Expand Down Expand Up @@ -54,6 +55,13 @@ lf`, () => {
});
});

// #295
describe('a "(name)"', () => {
it('mix of paranthesis and double quotes', () => {
expect(1).toBe(1);
});
});

// #311
it.each([1, 2])('test with generated %i', (id) => {
expect(true);
Expand Down
17 changes: 4 additions & 13 deletions src/test/commandBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { runJestCommand } from './util/runJestCommand';
import { Shell } from './util/shellHandler';
import { isWindows } from '../util';

const ALL_SHELLS: Array<Shell> = isWindows() ? ['cmd', 'powershell'] : ['bash'];
const ALL_SHELLS: Array<Shell> = isWindows() ? ['cmd'] : ['bash'];

describe('CommandBuilder', () => {
let tempDir: string;
Expand All @@ -29,6 +29,8 @@ describe('CommandBuilder', () => {
it('backticks', () => mustMatchSelf(shell, 'test with `backticks`'));
it('regex', () => mustMatchSelf(shell, 'test with regex .*$^|[]'));
it('prototype .name property', () => mustMatchSelf(shell, 'TestClass.prototype.myFunction.name', 'myFunction'));
it('mix of quotes and paranthesis', () =>
mustMatchSelf(shell, 'a "(name)"', 'mix of paranthesis and double quotes'));
});

async function mustMatchSelf(shell: Shell, testName: string, expectedTestName?: string) {
Expand All @@ -45,18 +47,7 @@ describe('CommandBuilder', () => {
}

// FIXME: these are broken
function shouldSkipMustMatchSelf(shell: Shell, testName: string): boolean {
if (isWindows()) {
if (shell === 'powershell' && testName === 'test with `backticks`') {
return true;
}
if (shell === 'powershell' && testName === 'test with " double quote') {
return true;
}
} else {
return shell === 'pwsh' && testName === `test with ' single quote`;
}

function shouldSkipMustMatchSelf(_shell: Shell, _testName: string): boolean {
return false;
}

Expand Down
70 changes: 0 additions & 70 deletions src/test/testProject/examples.test.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/test/testProject/jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/util/runJestCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const jestRunnerConfig: IJestRunnerCommandBuilderConfig = {
return '';
},
};
const testFileName = path.resolve(__dirname, '..', 'testProject', 'examples.test.ts');
const testFileName = path.resolve(__dirname, '..', '..', '..', 'examples', 'examples.test.ts');
const packageJsonDirectory = getPackageJsonDirectory();

export async function runJestCommand(shell: Shell, tempDir: string, testName: string) {
Expand Down

0 comments on commit 1694b2a

Please sign in to comment.