Skip to content

Commit 9d1f063

Browse files
committed
feat(ui-scripts,ui-test-utils): move jsdom to ui-scripts
TEST PLAN: yarn test:mocha should pass Change-Id: Ib658810e7d251d5f5e28c0c81afd11929a2732e1 Reviewed-on: https://gerrit.instructure.com/184271 Tested-by: Jenkins Reviewed-by: Chris Hart <chart@instructure.com> Product-Review: Chris Hart <chart@instructure.com> QA-Review: Jennifer Stern <jstern@instructure.com>
1 parent 92ba95e commit 9d1f063

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

packages/ui-scripts/lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ require('dotenv').config()
2929

3030
const commands = [
3131
'--publish',
32+
'--release',
3233
'--fix-publish',
3334
'--post-publish',
3435
'--bump',
@@ -56,7 +57,7 @@ if (process.argv.includes('--help')) {
5657
require('./post-publish')
5758
} else if (process.argv.includes('--bump')) {
5859
require('./bump')
59-
} else if (process.argv.includes('--publish')) {
60+
} else if (process.argv.includes('--publish') || process.argv.includes('--release')) {
6061
require('./publish')
6162
} else if (process.argv.includes('--fix-publish')) {
6263
require('./fix-publish')
@@ -87,4 +88,5 @@ if (process.argv.includes('--help')) {
8788
} else {
8889
error('[ui-scripts]: Invalid command!')
8990
listCommands()
91+
process.exit(1)
9092
}

packages/ui-scripts/lib/test/mocha.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ let args = [
3232
'--colors',
3333
'--require', '@babel/register',
3434
'--require', '@babel/polyfill',
35+
'--require', 'jsdom-global/register',
3536
'--exit'
3637
]
3738

packages/ui-scripts/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"gh-pages": "^2.0.1",
3636
"http-server": "^0.11.1",
3737
"jira-client": "^6.6.0",
38+
"jsdom-global": "^3.0.2",
3839
"karma-cli": "^2.0.0",
3940
"lerna": "^3",
4041
"mocha": "^6.0.2",
@@ -47,6 +48,7 @@
4748
"webpack-dev-server": "^3.2.1"
4849
},
4950
"peerDependencies": {
51+
"jsdom": ">=10.0.0",
5052
"react": "^0.14.9 || ^15 || ^16",
5153
"webpack": "^4"
5254
},

packages/ui-test-utils/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"chai-string": "^1.5.0",
3434
"dirty-chai": "^2.0.1",
3535
"fetch-mock": "^7.3.0",
36-
"jsdom-global": "^3.0.2",
3736
"keycode": "^2",
3837
"pretty-format": "^24.0.0",
3938
"sinon": "^7.2.3",
@@ -42,7 +41,6 @@
4241
"wait-for-expect": "^1.1.0"
4342
},
4443
"peerDependencies": {
45-
"jsdom": ">=10.0.0",
4644
"react": "^0.14.9 || ^15.0.0 || ^16.0.0",
4745
"react-dom": "^0.14.9 || ^15.0.0 || ^16.0.0"
4846
},

packages/ui-test-utils/src/utils/globals.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24-
import jsdom from 'jsdom-global'
2524
import MutationObserverShim from '@sheerun/mutationobserver-shim'
2625

2726
const noop = () => {}
@@ -30,7 +29,7 @@ let cleanupGlobals = noop
3029

3130
const initGlobals = () => {
3231
if (typeof document === 'undefined') {
33-
cleanupGlobals = jsdom()
32+
console.error(`[ui-test-utils] requires access to the DOM API!`)
3433
}
3534
// jsdom doesn't provide Date on the window object and we need it for wait-for-expect
3635
global.window.Date = (global.window.Date && global.window.Date.now) ? global.window.Date : global.Date

0 commit comments

Comments
 (0)