Skip to content

Commit

Permalink
fix: build @packages/errors in CI, defer import to prevent errors loc…
Browse files Browse the repository at this point in the history
…ally
  • Loading branch information
tgriesser authored and brian-mann committed Feb 5, 2022
1 parent 8935f18 commit 7e9468d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"browser": "src/index.ts",
"scripts": {
"test": "yarn test-unit",
"build": "tsc || echo 'type errors'",
"build": "../../scripts/run-if-ci.sh tsc || echo 'type errors'",
"build-prod": "tsc",
"postinstall": "rm -rf test/**/*.js",
"check-ts": "tsc --noEmit",
"clean-deps": "rm -rf node_modules",
"clean": "rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'",
Expand Down
3 changes: 1 addition & 2 deletions packages/server/lib/plugins/child/browser_launch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const util = require('../util')
const { getError } = require('@packages/errors')

const ARRAY_METHODS = ['concat', 'push', 'unshift', 'slice', 'pop', 'shift', 'slice', 'splice', 'filter', 'map', 'forEach', 'reduce', 'reverse', 'splice', 'includes']

Expand All @@ -21,7 +20,7 @@ module.exports = {

hasEmittedWarning = true

const warning = getError(
const warning = require('@packages/errors').getError(
'DEPRECATED_BEFORE_BROWSER_LAUNCH_ARGS',
)

Expand Down
3 changes: 1 addition & 2 deletions packages/server/lib/plugins/child/task.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const _ = require('lodash')
const util = require('../util')
const errors = require('@packages/errors')

const getBody = (ipc, events, ids, [event]) => {
const taskEvent = _.find(events, { event: 'task' }).handler
Expand All @@ -24,7 +23,7 @@ const merge = (prevEvents, events) => {
const duplicates = _.intersection(_.keys(prevEvents), _.keys(events))

if (duplicates.length) {
errors.warning('DUPLICATE_TASK_KEY', duplicates.join(', '))
require('@packages/errors').warning('DUPLICATE_TASK_KEY', duplicates.join(', '))
}

return _.extend(prevEvents, events)
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/integration/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ describe('lib/cypress', () => {

const found3 = _.find(argsSet, (args) => {
return _.find(args, (arg) => {
return arg.message && arg.message.includes(
return arg.message && stripAnsi(arg.message).includes(
'Available browsers found on your system are:\n- chrome\n- chromium\n- chrome:canary\n- electron',
)
})
Expand Down
6 changes: 6 additions & 0 deletions scripts/run-if-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# If we're in CI, exit early
if [[ !$CI ]]; then exit 0; fi
# otherwise, run the supplied command
"${@:1}"
2 changes: 0 additions & 2 deletions system-tests/__snapshots__/plugin_run_events_spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,4 @@ The error we received was:
Error: error thrown in before:spec
[stack trace lines]
`

0 comments on commit 7e9468d

Please sign in to comment.