Skip to content

Commit

Permalink
Use plain node instead of jsdom environment when testing jbrowse/img
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 6, 2022
1 parent f143571 commit 5eda5e6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"check-format": "prettier --check .",
"typecheck": "tsc --noEmit",
"pretest-ci": "cd products/jbrowse-react-linear-genome-view;yarn build;cd ../../",
"test-ci": "cross-env NODE_OPTIONS='--max-old-space-size=7000' jest --ci --coverage && jest --testMatch '**/*testmod.js'",
"test-ci": "cross-env NODE_OPTIONS='--max-old-space-size=7000' jest --ci --coverage && jest --env node --testMatch '**/*testmod.js'",
"built-test-ci": "jest --ci integration.test.js",
"test": "jest"
},
Expand Down
6 changes: 4 additions & 2 deletions products/jbrowse-img/src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/* eslint-disable no-console */
import fs from 'fs'
import yargs from 'yargs'
import jsdom from 'jsdom'
import { standardizeArgv, parseArgv } from './parseArgv'
import { renderRegion } from './renderRegion'
import tmp from 'tmp'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import { spawnSync } from 'child_process'
import fetch, { Headers, Response, Request } from 'node-fetch'
import { JSDOM } from 'jsdom'

const { document } = new JSDOM(`...`).window
global.document = document

global.document = jsdom.jsdom()
if (!global.fetch) {
global.fetch = fetch
global.Headers = Headers
Expand Down
5 changes: 5 additions & 0 deletions products/jbrowse-img/src/index.testmod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { renderRegion } from './renderRegion'
import fs from 'fs'
import { JSDOM } from 'jsdom'
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'

const { document } = new JSDOM(`...`).window
global.document = document

function hashCode(str) {
let hash = 0
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5eda5e6

Please sign in to comment.