-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathtest.config.js
More file actions
61 lines (55 loc) · 1.53 KB
/
test.config.js
File metadata and controls
61 lines (55 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Add performance polyfill for Node.js 22 compatibility
if (typeof performance === "undefined") {
global.performance = require("perf_hooks").performance
}
require("regenerator-runtime/runtime")
require("@babel/register")({
extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx"],
})
require("coffeescript/register")
require("raf/polyfill")
require("should")
require("dotenv").config({
path: require("path").join(process.cwd(), ".env.test"),
})
const $ = require("jquery")
const Adapter = require("enzyme-adapter-react-16")
const Enzyme = require("enzyme")
const React = require("react")
const DOM = require("react-dom-factories")
const createClass = require("create-react-class")
const sd = require("sharify")
const {
FeatureArticle,
} = require("@artsy/reaction/dist/Components/Publishing/Fixtures/Articles")
// Patch React 16 with deprecated helpers
// eslint-disable-next-line react/no-deprecated
React.DOM = DOM
// eslint-disable-next-line react/no-deprecated
React.createClass = createClass
Enzyme.configure({
adapter: new Adapter(),
})
try {
global.$ = global.jQuery = $
window.innerHeight = 900
window.innerWidth = 1400
window.scrollY = 200
window.scrollTo = () => {}
window.matchMedia =
window.matchMedia ||
function() {
return {
matches: false,
addListener: function() {},
removeListener: function() {},
}
}
} catch (error) {
console.error("Error setting up global variables:", error)
}
sd.data = {
ARTICLE: FeatureArticle,
CHANNEL: {},
USER: { id: "57b5fc6acd530e65f8000406" },
}