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
6 changes: 5 additions & 1 deletion .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const path = require('path');

module.exports = {
presets: ['@theforeman/builder/babel'],
presets: [
require.resolve(path.resolve(__dirname, '../foreman/webpack/babel')),
],
};
13 changes: 0 additions & 13 deletions .eslintrc

This file was deleted.

34 changes: 12 additions & 22 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
const tfmConfig = require('@theforeman/test/src/pluginConfig');
const { foremanRelativePath, foremanLocation } = require('@theforeman/find-foreman');

const foremanReactRelative = 'webpack/assets/javascripts/react_app';
const foremanFull = foremanLocation();
const foremanReactFull = foremanRelativePath(foremanReactRelative);

tfmConfig.moduleNameMapper['^foremanReact(.*)$'] = `${foremanReactFull}/$1`;

tfmConfig.resolver = null;
tfmConfig.moduleDirectories = [
`${foremanFull}/node_modules`,
`${foremanFull}/node_modules/@theforeman/vendor-core/node_modules`,
'node_modules',
];

tfmConfig.setupFilesAfterEnv = [
...(tfmConfig.setupFilesAfterEnv || []),
'@testing-library/jest-dom',
];

module.exports = tfmConfig;
const path = require('path');

const foreman = path.resolve(__dirname, '../foreman');

module.exports = {
rootDir: __dirname,
setupFilesAfterEnv: [
require.resolve('@testing-library/jest-dom', { paths: [foreman] }),
],
moduleDirectories: [`${foreman}/node_modules`, 'node_modules'],
resolver: null,
};
15 changes: 1 addition & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
"version": "1.0.0",
"license": "GPL-3.0",
"scripts": {
"lint": "tfm-lint --plugin -d /webpack",
"lint:custom": "eslint ./webpack",
"test": "tfm-test --plugin --config jest.config.js",
"test:watch": "tfm-test --plugin --config jest.config.js --watchAll",
"test:current": "tfm-test --plugin --config jest.config.js --watch",
"publish-coverage": "tfm-publish-coverage"
"lint:custom": "eslint ./webpack"
},
Comment thread
Lukshio marked this conversation as resolved.
Resolved
"repository": {
"type": "git",
Expand All @@ -19,11 +14,6 @@
},
"devDependencies": {
"@babel/core": "^7.7.0",
"@theforeman/builder": ">= 15.0.1",
"@theforeman/eslint-plugin-foreman": ">= 15.0.1",
"@theforeman/eslint-plugin-rules": ">= 15.0.1",
"@theforeman/test": ">= 15.0.1",
"@theforeman/vendor-dev": ">= 15.0.1",
"babel-eslint": "^10.0.0",
"eslint": "^6.8.0",
"prettier": "^1.19.1",
Expand All @@ -32,8 +22,5 @@
"graphql": "^15.5.0",
"victory-core": "~36.8.6",
"victory-pie": "~36.8.6"
},
"peerDependencies": {
"@theforeman/vendor": ">= 15.0.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
import { createMemoryHistory } from 'history';
import { Router } from 'react-router-dom';
import JobInvocationEmptyState from '../JobInvocationEmptyState';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
import { OutputCodeBlock } from '../TemplateInvocationComponents/OutputCodeBlock';
import { jobInvocationOutput } from './fixtures';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import axios from 'axios';
import { foremanUrl } from 'foremanReact/common/helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
// eslint-disable-next-line import/no-extraneous-dependencies
import API from 'foremanReact/API';
import * as api from 'foremanReact/redux/API';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import { render, act, cleanup, screen } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
// eslint-disable-next-line import/no-extraneous-dependencies
import API from 'foremanReact/API';
import { addToast } from 'foremanReact/components/ToastsList';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { screen, fireEvent, render, act } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
import RexInterface from '../RexInterface';

const fixtures = {
Expand Down
Loading