Testing Extension-less Component Imports in Create React App
This test suite validates the proper rendering of components without file extensions in Create React App. It focuses on ensuring that components can be imported and rendered successfully without explicitly specifying file extensions, demonstrating webpack’s module resolution capabilities.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
facebook/create-react-app
packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/NoExtInclusion.test.js
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import NoExtInclusion from './NoExtInclusion';
describe('no ext inclusion', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<NoExtInclusion />, div);
});
});