Unverified Commit d0994cae authored by Tamika Tannis's avatar Tamika Tannis Committed by GitHub

Configure support for absolute imports (#93)

* Update configs + a few imports for testing, fix misnamed files

* Some cleanup
parent 73ed1dd7
...@@ -25,6 +25,7 @@ module.exports = { ...@@ -25,6 +25,7 @@ module.exports = {
'^.+\\.(css|scss)$': '<rootDir>/node_modules/jest-css-modules', '^.+\\.(css|scss)$': '<rootDir>/node_modules/jest-css-modules',
}, },
testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(j|t)sx?$', testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(j|t)sx?$',
moduleDirectories: ['node_modules', 'js'],
moduleFileExtensions: [ moduleFileExtensions: [
'ts', 'ts',
'tsx', 'tsx',
......
import * as React from 'react'; import * as React from 'react';
import InfoButton from "../../InfoButton"; import InfoButton from 'components/common/InfoButton';
// TODO: Use css-modules instead of 'import' // TODO: Use css-modules instead of 'import'
import './styles.scss'; import './styles.scss';
......
...@@ -2,7 +2,7 @@ import * as React from 'react'; ...@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import InfoButton from "../../../InfoButton"; import InfoButton from 'components/common/InfoButton';
import EntityCardSection, { EntityCardSectionProps } from '../'; import EntityCardSection, { EntityCardSectionProps } from '../';
describe('EntityCardSection', () => { describe('EntityCardSection', () => {
......
...@@ -3,7 +3,6 @@ import * as React from 'react'; ...@@ -3,7 +3,6 @@ import * as React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Avatar from 'react-avatar'; import Avatar from 'react-avatar';
import Flag from '../../../Flag';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import TableListItem, { TableListItemProps } from '../'; import TableListItem, { TableListItemProps } from '../';
......
...@@ -3,7 +3,7 @@ import Avatar from 'react-avatar'; ...@@ -3,7 +3,7 @@ import Avatar from 'react-avatar';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { LoggingParams, UserResource} from '../types'; import { LoggingParams, UserResource} from '../types';
import Flag from '../../Flag'; import Flag from 'components/common/Flag';
export interface UserListItemProps { export interface UserListItemProps {
user: UserResource; user: UserResource;
......
...@@ -3,7 +3,7 @@ import * as React from 'react'; ...@@ -3,7 +3,7 @@ import * as React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Avatar from 'react-avatar'; import Avatar from 'react-avatar';
import Flag from '../../../Flag'; import Flag from 'components/common/Flag';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import UserListItem, { UserListItemProps } from '../'; import UserListItem, { UserListItemProps } from '../';
......
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
"noResolve": false, "noResolve": false,
"removeComments": true, "removeComments": true,
"types": ["jest"], "types": ["jest"],
"baseUrl": "js",
"paths": {
"components/*": [ "components/*" ],
"ducks/*": [ "ducks/*" ],
}
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
......
...@@ -15,6 +15,10 @@ const config: webpack.Configuration = { ...@@ -15,6 +15,10 @@ const config: webpack.Configuration = {
}, },
devtool: 'source-map', devtool: 'source-map',
resolve: { resolve: {
alias: {
components: path.join(__dirname, '/js/components'),
ducks: path.join(__dirname, '/js/ducks'),
},
extensions: ['.tsx', '.ts', '.js', '.jsx', '.css', '.scss'], extensions: ['.tsx', '.ts', '.js', '.jsx', '.css', '.scss'],
}, },
module: { module: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment