forked from yjs/y-prosemirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.node.js
51 lines (45 loc) · 997 Bytes
/
index.node.js
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
// @ts-nocheck
import fs from 'fs'
import path from 'path'
import jsdom from 'jsdom'
import * as prosemirror from './y-prosemirror.test.js'
import { runTests } from 'lib0/testing'
import { isBrowser, isNode } from 'lib0/environment'
import * as log from 'lib0/logging'
const documentContent = fs.readFileSync(path.join(__dirname, '../test.html'))
const { window } = new jsdom.JSDOM(documentContent)
global.window = window
global.document = window.document
global.innerHeight = 0
document.getSelection = () => ({ })
document.createRange = () => ({
setStart () {},
setEnd () {},
getClientRects () {
return {
left: 0,
top: 0,
right: 0,
bottom: 0
}
},
getBoundingClientRect () {
return {
left: 0,
top: 0,
right: 0,
bottom: 0
}
}
})
if (isBrowser) {
log.createVConsole(document.body)
}
runTests({
prosemirror
}).then(success => {
/* istanbul ignore next */
if (isNode) {
process.exit(success ? 0 : 1)
}
})