Skip to content

Commit

Permalink
feat(jest-runner): remove deprecated project types (#2361)
Browse files Browse the repository at this point in the history
Remove deprecated project types.
* `react` --> `create-react-app`
* `react-ts` --> `create-react-app-ts`

BREAKING CHANGE: Project types `react` and `react-ts` has been removed. Please use `create-react-app` and `create-react-app-ts` respectively
  • Loading branch information
nicojs committed Aug 7, 2020
1 parent 68496cd commit d0aa5c3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 38 deletions.
2 changes: 0 additions & 2 deletions packages/jest-runner/schema/jest-runner-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
"enum": [
"create-react-app",
"create-react-app-ts",
"react",
"react-ts",
"custom"
]
}
Expand Down
12 changes: 0 additions & 12 deletions packages/jest-runner/src/configLoaders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ export function configLoaderFactory(options: StrykerOptions, injector: Injector<
case 'create-react-app-ts':
warnAboutConfigFile(optionsWithJest.jest.projectType, optionsWithJest.jest.configFile);
return configLoaderInjector.injectClass(ReactScriptsTSJestConfigLoader);
case 'react':
log.warn(
'DEPRECATED: The projectType "react" is deprecated. Use projectType "create-react-app" for react projects created by "create-react-app" or use "custom" for other react projects.'
);
warnAboutConfigFile(optionsWithJest.jest.projectType, optionsWithJest.jest.configFile);
return configLoaderInjector.injectClass(ReactScriptsJestConfigLoader);
case 'react-ts':
log.warn(
'DEPRECATED: The projectType "react-ts" is deprecated. Use projectType "create-react-app-ts" for react projects created by "create-react-app" or use "custom" for other react projects.'
);
warnAboutConfigFile(optionsWithJest.jest.projectType, optionsWithJest.jest.configFile);
return configLoaderInjector.injectClass(ReactScriptsTSJestConfigLoader);
default:
throw new Error(`No configLoader available for ${optionsWithJest.jest.projectType}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ describe(`${JestTestRunner.name} integration test`, () => {
};

describe('dryRun', () => {
it.skip('should run tests on the example React + TypeScript project', async () => {
it('should run tests on the example React + TypeScript project', async () => {
// TODO: Get a proper React TS project that works on Windows
process.chdir(getProjectRoot('reactTsProject'));
const jestTestRunner = createSut({ projectType: 'react-ts' });
const jestTestRunner = createSut({ projectType: 'create-react-app-ts' });

const runResult = await jestTestRunner.dryRun();

assertions.expectCompleted(runResult);
expectToHaveSuccessfulTests(runResult, 1);
});

it.skip('should set the test name and timeSpentMs', async () => {
it('should set the test name and timeSpentMs', async () => {
process.chdir(getProjectRoot('reactTsProject'));
const jestTestRunner = createSut({ projectType: 'react-ts' });
const jestTestRunner = createSut({ projectType: 'create-react-app-ts' });

const runResult = await jestTestRunner.dryRun();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ describe(configLoaderFactory.name, () => {
expect(sut).eq(customConfigLoaderStub);
});

describe('with "projectType": "react"', () => {
describe('with "projectType": "create-react-app"', () => {
beforeEach(() => {
options.jest.projectType = 'react';
options.jest.projectType = 'create-react-app';
});

it('should create a ReactScriptsJestConfigLoader', () => {
Expand All @@ -63,19 +63,11 @@ describe(configLoaderFactory.name, () => {
it('should warn when a configFile is set', () => {
testConfigFileWarning(options);
});

it('should log a deprecation warning', () => {
testInjector.injector.provideValue(commonTokens.options, options).injectFunction(configLoaderFactory);

expect(testInjector.logger.warn).calledWith(
'DEPRECATED: The projectType "react" is deprecated. Use projectType "create-react-app" for react projects created by "create-react-app" or use "custom" for other react projects.'
);
});
});

describe('with "projectType": "react-ts"', () => {
describe('with "projectType": "create-react-app-ts"', () => {
beforeEach(() => {
options.jest.projectType = 'react-ts';
options.jest.projectType = 'create-react-app-ts';
});

it('should create a ReactScriptsTSJestConfigLoader', () => {
Expand All @@ -87,14 +79,6 @@ describe(configLoaderFactory.name, () => {
it('should warn when a configFile is set', () => {
testConfigFileWarning(options);
});

it('should log a deprecation warning', () => {
testInjector.injector.provideValue(commonTokens.options, options).injectFunction(configLoaderFactory);

expect(testInjector.logger.warn).calledWith(
'DEPRECATED: The projectType "react-ts" is deprecated. Use projectType "create-react-app-ts" for react projects created by "create-react-app" or use "custom" for other react projects.'
);
});
});
});

Expand Down

0 comments on commit d0aa5c3

Please sign in to comment.