Migrate from karma+mocha to jest

This commit is contained in:
SleepWalker
2019-11-27 10:09:51 +02:00
parent 06597c482a
commit 991031f211
15 changed files with 1272 additions and 1109 deletions

View File

@@ -0,0 +1,22 @@
/* eslint-env node */
const path = require("path");
const { transform } = require("../../webpack-utils/intl-loader");
module.exports = {
/**
* @param {string} src - transformed module source code
* @param {string} filename - transformed module file path
* @param {{[key: string]: any}} config - jest config
* @param {{instrument: boolean}} options - additional options
*
* @return {string}
*/
// eslint-disable-next-line no-unused-vars
process(src, filename, config, options) {
return transform(
src,
filename,
path.resolve(`${__dirname}/../../..`)
);
}
};

View File

@@ -0,0 +1 @@
module.exports = 'test-file-stub';

23
jest/setupAfterEnv.js Normal file
View File

@@ -0,0 +1,23 @@
import 'polyfills';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
if (!window.localStorage) {
window.localStorage = {
getItem(key) {
return this[key] || null;
},
setItem(key, value) {
this[key] = value;
},
removeItem(key) {
delete this[key];
}
};
window.sessionStorage = {
...window.localStorage
};
}