Skip to content

Commit

Permalink
move tests to esm file
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Nov 15, 2021
1 parent fb0b5d3 commit efc6177
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "y-codemirror",
"version": "3.0.0",
"type": "module",
"description": "CodeMirror binding for Yjs",
"main": "./dist/y-codemirror.cjs",
"types": "./dist/src/y-codemirror.d.ts",
Expand All @@ -25,8 +26,8 @@
"clean": "rm -rf dist",
"dist": "npm run clean && rollup -c && tsc",
"watch": "rollup -wc",
"test": "npm run dist && node test/test.node.cjs",
"test-extensive": "npm run dist && node test/test.node.cjs --production --repetition-time 10000",
"test": "npm run dist && node test/test.node.js",
"test-extensive": "npm run dist && node test/test.node.js --production --repetition-time 10000",
"lint": "standard && tsc",
"preversion": "npm run lint && npm run test-extensive && npm run dist",
"debug": "concurrently 'http-server -o test.html' 'npm run watch'",
Expand All @@ -46,7 +47,7 @@
},
"homepage": "https://github.com/yjs/y-codemirror#readme",
"peerDependencies": {
"yjs": "^13.0.0",
"yjs": "^13.5.17",
"codemirror": "^5.52.2"
},
"dependencies": {
Expand All @@ -64,6 +65,6 @@
"standard": "^14.3.4",
"typescript": "^3.9.10",
"y-webrtc": "^10.2.0",
"yjs": "^13.5.17"
"yjs": "^13.5.18"
}
}
15 changes: 0 additions & 15 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,4 @@ export default [{
}),
commonjs()
]
}, {
input: './test/index.js',
output: {
name: 'test',
file: 'dist/test.cjs',
format: 'cjs',
sourcemap: true
},
plugins: [
debugResolve,
nodeResolve({
mainFields: ['module', 'main']
})
],
external: id => /^(lib0|codemirror|fs|path|jsdom|isomorphic)/.test(id)
}]
11 changes: 6 additions & 5 deletions test/test.node.cjs → test/test.node.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// @ts-nocheck

const fs = require('fs')
const path = require('path')
const jsdom = require('jsdom')
import fs from 'fs'
import jsdom from 'jsdom'

const documentContent = fs.readFileSync(path.join(__dirname, '../test.html'))
const documentContent = fs.readFileSync('test.html')
const { window } = new jsdom.JSDOM(documentContent)

global.window = window
Expand Down Expand Up @@ -34,4 +33,6 @@ document.createRange = () => ({
}
})

require('../dist/test.cjs')
import('./index.js').then(() => {
console.log('')
})

0 comments on commit efc6177

Please sign in to comment.