From 252be9e26e6a9d46b9269ea88efeffa5b0cd30db Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 25 Oct 2021 09:41:03 -0500 Subject: [PATCH] chore(server): align test folder structure to src folder structure (#18597) --- packages/server/lib/config.ts | 14 +----- packages/server/lib/util/config.ts | 17 +++++-- .../test/unit/browsers/browsers_spec.js | 2 +- packages/server/test/unit/config_spec.js | 22 --------- .../server/test/unit/{ => util}/args_spec.js | 6 +-- .../test/unit/{ => util}/cache_buster_spec.js | 4 +- .../unit/{ => util}/chrome_policy_check.js | 4 +- .../test/unit/{ => util}/ci_provider_spec.js | 4 +- .../test/unit/{ => util}/coerce_spec.js | 6 +-- packages/server/test/unit/util/config_spec.js | 48 +++++++++++++++++++ .../test/unit/{ => util}/duration_spec.js | 4 +- .../test/unit/{ => util}/ensure_url_spec.ts | 4 +- .../server/test/unit/{ => util}/file_spec.js | 10 ++-- .../test/unit/{ => util}/human_time_spec.js | 4 +- .../test/unit/{ => util}/newlines_spec.ts | 4 +- .../server/test/unit/{ => util}/open_spec.js | 4 +- .../test/unit/{ => util}/origin_spec.js | 4 +- .../test/unit/{ => util}/path_helpers_spec.js | 4 +- .../unit/{ => util}/profile_cleaner_spec.js | 8 ++-- .../test/unit/{ => util}/random_spec.js | 4 +- .../routes_spec.js} | 4 +- .../server/test/unit/{ => util}/specs_spec.js | 6 +-- .../unit/{ => util}/stream_buffer_spec.js | 4 +- .../unit/{ => util}/suppress_warnings_spec.ts | 6 +-- .../test/unit/{ => util}/terminal_spec.js | 8 ++-- .../server/test/unit/{ => util}/trash_spec.js | 4 +- .../server/test/unit/{ => util}/tty_spec.js | 6 +-- 27 files changed, 118 insertions(+), 97 deletions(-) rename packages/server/test/unit/{ => util}/args_spec.js (99%) rename packages/server/test/unit/{ => util}/cache_buster_spec.js (85%) rename packages/server/test/unit/{ => util}/chrome_policy_check.js (94%) rename packages/server/test/unit/{ => util}/ci_provider_spec.js (99%) rename packages/server/test/unit/{ => util}/coerce_spec.js (94%) create mode 100644 packages/server/test/unit/util/config_spec.js rename packages/server/test/unit/{ => util}/duration_spec.js (88%) rename packages/server/test/unit/{ => util}/ensure_url_spec.ts (95%) rename packages/server/test/unit/{ => util}/file_spec.js (97%) rename packages/server/test/unit/{ => util}/human_time_spec.js (93%) rename packages/server/test/unit/{ => util}/newlines_spec.ts (83%) rename packages/server/test/unit/{ => util}/open_spec.js (92%) rename packages/server/test/unit/{ => util}/origin_spec.js (85%) rename packages/server/test/unit/{ => util}/path_helpers_spec.js (84%) rename packages/server/test/unit/{ => util}/profile_cleaner_spec.js (92%) rename packages/server/test/unit/{ => util}/random_spec.js (88%) rename packages/server/test/unit/{routes_util_spec.js => util/routes_spec.js} (93%) rename packages/server/test/unit/{ => util}/specs_spec.js (97%) rename packages/server/test/unit/{ => util}/stream_buffer_spec.js (98%) rename packages/server/test/unit/{ => util}/suppress_warnings_spec.ts (87%) rename packages/server/test/unit/{ => util}/terminal_spec.js (94%) rename packages/server/test/unit/{ => util}/trash_spec.js (96%) rename packages/server/test/unit/{ => util}/tty_spec.js (95%) diff --git a/packages/server/lib/config.ts b/packages/server/lib/config.ts index 17aad0a1a0..16e460e93e 100644 --- a/packages/server/lib/config.ts +++ b/packages/server/lib/config.ts @@ -17,7 +17,7 @@ import findSystemNode from './util/find_system_node' const debug = Debug('cypress:server:config') import { options, breakingOptions } from './config_options' -import { getProcessEnvVars } from './util/config' +import { getProcessEnvVars, CYPRESS_SPECIAL_ENV_VARS } from './util/config' export const RESOLVED_FROM = ['plugin', 'env', 'default', 'runtime', 'config'] as const @@ -32,18 +32,6 @@ export type ResolvedConfigurationOptions = Partial<{ [x in keyof Cypress.ResolvedConfigOptions]: ResolvedFromConfig }> -export const CYPRESS_ENV_PREFIX = 'CYPRESS_' - -export const CYPRESS_ENV_PREFIX_LENGTH = 'CYPRESS_'.length - -export const CYPRESS_RESERVED_ENV_VARS = [ - 'CYPRESS_INTERNAL_ENV', -] - -export const CYPRESS_SPECIAL_ENV_VARS = [ - 'RECORD_KEY', -] - const dashesOrUnderscoresRe = /^(_-)+/ // takes an array and creates an index object of [keyKey]: [valueKey] diff --git a/packages/server/lib/util/config.ts b/packages/server/lib/util/config.ts index 06bae0dbae..0bb4c8e7ee 100644 --- a/packages/server/lib/util/config.ts +++ b/packages/server/lib/util/config.ts @@ -1,11 +1,18 @@ import _ from 'lodash' -import { - CYPRESS_ENV_PREFIX, - CYPRESS_ENV_PREFIX_LENGTH, - CYPRESS_RESERVED_ENV_VARS, -} from '../config' import { coerce } from './coerce' +export const CYPRESS_ENV_PREFIX = 'CYPRESS_' + +export const CYPRESS_ENV_PREFIX_LENGTH = 'CYPRESS_'.length + +export const CYPRESS_RESERVED_ENV_VARS = [ + 'CYPRESS_INTERNAL_ENV', +] + +export const CYPRESS_SPECIAL_ENV_VARS = [ + 'RECORD_KEY', +] + export const isDefault = (config: Record, prop: string) => { return config.resolved[prop].from === 'default' } diff --git a/packages/server/test/unit/browsers/browsers_spec.js b/packages/server/test/unit/browsers/browsers_spec.js index 96235f1b18..4633589351 100644 --- a/packages/server/test/unit/browsers/browsers_spec.js +++ b/packages/server/test/unit/browsers/browsers_spec.js @@ -5,7 +5,7 @@ const utils = require(`${root}../lib/browsers/utils`) const snapshot = require('snap-shot-it') const normalizeBrowsers = (message) => { - return message.replace(/(found are: ).*/, '$1chrome, firefox, electron') + return message.replace(/(found on your system are:)((\n.*)*)/, '$1\n- chrome\n- firefox\n- electron') } // When we added component testing mode, we added the option for electron to be omitted diff --git a/packages/server/test/unit/config_spec.js b/packages/server/test/unit/config_spec.js index 8a712138ff..76b0819510 100644 --- a/packages/server/test/unit/config_spec.js +++ b/packages/server/test/unit/config_spec.js @@ -2412,25 +2412,3 @@ describe('lib/config', () => { }) }) }) - -describe('lib/util/config', () => { - context('.isDefault', () => { - it('returns true if value is default value', () => { - settings = { baseUrl: null } - const defaults = { baseUrl: null } - const resolved = {} - const merged = config.setResolvedConfigValues(settings, defaults, resolved) - - expect(configUtil.isDefault(merged, 'baseUrl')).to.be.true - }) - - it('returns false if value is not default value', () => { - settings = { baseUrl: null } - const defaults = { baseUrl: 'http://localhost:8080' } - const resolved = {} - const merged = config.setResolvedConfigValues(settings, defaults, resolved) - - expect(configUtil.isDefault(merged, 'baseUrl')).to.be.false - }) - }) -}) diff --git a/packages/server/test/unit/args_spec.js b/packages/server/test/unit/util/args_spec.js similarity index 99% rename from packages/server/test/unit/args_spec.js rename to packages/server/test/unit/util/args_spec.js index 6b92bdddef..06309170e9 100644 --- a/packages/server/test/unit/args_spec.js +++ b/packages/server/test/unit/util/args_spec.js @@ -1,12 +1,12 @@ -require('../spec_helper') +require('../../spec_helper') const path = require('path') const os = require('os') const snapshot = require('snap-shot-it') const stripAnsi = require('strip-ansi') const minimist = require('minimist') -const argsUtil = require(`${root}lib/util/args`) -const getWindowsProxyUtil = require(`${root}lib/util/get-windows-proxy`) +const argsUtil = require(`${root}../lib/util/args`) +const getWindowsProxyUtil = require(`${root}../lib/util/get-windows-proxy`) const cwd = process.cwd() diff --git a/packages/server/test/unit/cache_buster_spec.js b/packages/server/test/unit/util/cache_buster_spec.js similarity index 85% rename from packages/server/test/unit/cache_buster_spec.js rename to packages/server/test/unit/util/cache_buster_spec.js index eb981877b1..4c8ee580c1 100644 --- a/packages/server/test/unit/cache_buster_spec.js +++ b/packages/server/test/unit/util/cache_buster_spec.js @@ -1,6 +1,6 @@ -require('../spec_helper') +require('../../spec_helper') -const CacheBuster = require(`${root}lib/util/cache_buster`) +const CacheBuster = require(`${root}../lib/util/cache_buster`) describe('lib/cache_buster', () => { context('#get', () => { diff --git a/packages/server/test/unit/chrome_policy_check.js b/packages/server/test/unit/util/chrome_policy_check.js similarity index 94% rename from packages/server/test/unit/chrome_policy_check.js rename to packages/server/test/unit/util/chrome_policy_check.js index a576044ef6..449f39b681 100644 --- a/packages/server/test/unit/chrome_policy_check.js +++ b/packages/server/test/unit/util/chrome_policy_check.js @@ -1,8 +1,8 @@ -require('../spec_helper') +require('../../spec_helper') const _ = require('lodash') const { stripIndent } = require('common-tags') -const chromePolicyCheck = require(`${root}lib/util/chrome_policy_check`) +const chromePolicyCheck = require(`${root}../lib/util/chrome_policy_check`) describe('lib/util/chrome_policy_check', () => { context('.getRunner returns a function', () => { diff --git a/packages/server/test/unit/ci_provider_spec.js b/packages/server/test/unit/util/ci_provider_spec.js similarity index 99% rename from packages/server/test/unit/ci_provider_spec.js rename to packages/server/test/unit/util/ci_provider_spec.js index 5fbaf29d55..77e2c1e128 100644 --- a/packages/server/test/unit/ci_provider_spec.js +++ b/packages/server/test/unit/util/ci_provider_spec.js @@ -1,8 +1,8 @@ const mockedEnv = require('mocked-env') -require('../spec_helper') +require('../../spec_helper') -const ciProvider = require(`${root}lib/util/ci_provider`) +const ciProvider = require(`${root}../lib/util/ci_provider`) const expectsName = (name) => { expect(ciProvider.provider(), 'CI providers detected name').to.eq(name) diff --git a/packages/server/test/unit/coerce_spec.js b/packages/server/test/unit/util/coerce_spec.js similarity index 94% rename from packages/server/test/unit/coerce_spec.js rename to packages/server/test/unit/util/coerce_spec.js index d1e33d7246..b6b58a7898 100644 --- a/packages/server/test/unit/coerce_spec.js +++ b/packages/server/test/unit/util/coerce_spec.js @@ -1,7 +1,7 @@ -require('../spec_helper') +require('../../spec_helper') -const { coerce } = require(`${root}lib/util/coerce`) -const { getProcessEnvVars } = require(`${root}lib/util/config`) +const { coerce } = require(`${root}../lib/util/coerce`) +const { getProcessEnvVars } = require(`${root}../lib/util/config`) describe('lib/util/coerce', () => { beforeEach(function () { diff --git a/packages/server/test/unit/util/config_spec.js b/packages/server/test/unit/util/config_spec.js new file mode 100644 index 0000000000..aaa99ab53e --- /dev/null +++ b/packages/server/test/unit/util/config_spec.js @@ -0,0 +1,48 @@ +require('../../spec_helper') + +const configUtil = require(`${root}../lib/util/config`) + +describe('lib/util/config', () => { + context('.isDefault', () => { + it('returns true if value is default value', () => { + const options = { + resolved: { + baseUrl: { from: 'default' }, + }, + } + + expect(configUtil.isDefault(options, 'baseUrl')).to.be.true + }) + + it('returns false if value is not default value', () => { + const options = { + resolved: { + baseUrl: { from: 'cli' }, + }, + } + + expect(configUtil.isDefault(options, 'baseUrl')).to.be.false + }) + }) + + context('.getProcessEnvVars', () => { + it('returns process envs prefixed with cypress', () => { + const envs = { + CYPRESS_BASE_URL: 'value', + RANDOM_ENV: 'ignored', + } + + expect(configUtil.getProcessEnvVars(envs)).to.deep.eq({ + BASE_URL: 'value', + }) + }) + + it('does not return CYPRESS_RESERVED_ENV_VARS', () => { + const envs = { + CYPRESS_INTERNAL_ENV: 'value', + } + + expect(configUtil.getProcessEnvVars(envs)).to.deep.eq({}) + }) + }) +}) diff --git a/packages/server/test/unit/duration_spec.js b/packages/server/test/unit/util/duration_spec.js similarity index 88% rename from packages/server/test/unit/duration_spec.js rename to packages/server/test/unit/util/duration_spec.js index 251b567ee1..6c23bc939f 100644 --- a/packages/server/test/unit/duration_spec.js +++ b/packages/server/test/unit/util/duration_spec.js @@ -1,6 +1,6 @@ -require('../spec_helper') +require('../../spec_helper') -const duration = require(`${root}lib/util/duration`) +const duration = require(`${root}../lib/util/duration`) describe('lib/util/duration', () => { context('.format', () => { diff --git a/packages/server/test/unit/ensure_url_spec.ts b/packages/server/test/unit/util/ensure_url_spec.ts similarity index 95% rename from packages/server/test/unit/ensure_url_spec.ts rename to packages/server/test/unit/util/ensure_url_spec.ts index b80aa01171..47c8af1904 100644 --- a/packages/server/test/unit/ensure_url_spec.ts +++ b/packages/server/test/unit/util/ensure_url_spec.ts @@ -1,7 +1,7 @@ -import '../spec_helper' +import '../../spec_helper' import { connect, agent } from '@packages/network' -import { isListening } from '../../lib/util/ensure-url' +import { isListening } from '../../../lib/util/ensure-url' import sinon from 'sinon' import nock from 'nock' diff --git a/packages/server/test/unit/file_spec.js b/packages/server/test/unit/util/file_spec.js similarity index 97% rename from packages/server/test/unit/file_spec.js rename to packages/server/test/unit/util/file_spec.js index fded35dceb..f126b7238f 100644 --- a/packages/server/test/unit/file_spec.js +++ b/packages/server/test/unit/util/file_spec.js @@ -1,13 +1,13 @@ -require('../spec_helper') +require('../../spec_helper') const os = require('os') const path = require('path') const Promise = require('bluebird') const lockFile = Promise.promisifyAll(require('lockfile')) -const { fs } = require(`${root}lib/util/fs`) -const env = require(`${root}lib/util/env`) -const exit = require(`${root}lib/util/exit`) -const FileUtil = require(`${root}lib/util/file`) +const { fs } = require(`${root}../lib/util/fs`) +const env = require(`${root}../lib/util/env`) +const exit = require(`${root}../lib/util/exit`) +const FileUtil = require(`${root}../lib/util/file`) describe('lib/util/file', () => { beforeEach(function () { diff --git a/packages/server/test/unit/human_time_spec.js b/packages/server/test/unit/util/human_time_spec.js similarity index 93% rename from packages/server/test/unit/human_time_spec.js rename to packages/server/test/unit/util/human_time_spec.js index c61bd1148c..d93710a311 100644 --- a/packages/server/test/unit/human_time_spec.js +++ b/packages/server/test/unit/util/human_time_spec.js @@ -1,7 +1,7 @@ -require('../spec_helper') +require('../../spec_helper') const humanInterval = require('human-interval') -const humanTime = require(`${root}lib/util/human_time`) +const humanTime = require(`${root}../lib/util/human_time`) describe('lib/util/human_time', () => { context('.long', () => { diff --git a/packages/server/test/unit/newlines_spec.ts b/packages/server/test/unit/util/newlines_spec.ts similarity index 83% rename from packages/server/test/unit/newlines_spec.ts rename to packages/server/test/unit/util/newlines_spec.ts index a3050923d0..a5f06ca4aa 100644 --- a/packages/server/test/unit/newlines_spec.ts +++ b/packages/server/test/unit/util/newlines_spec.ts @@ -1,6 +1,6 @@ -import '../spec_helper' +import '../../spec_helper' -import newlines from '../../lib/util/newlines' +import newlines from '../../../lib/util/newlines' describe('lib/util/newlines', function () { it('inserts newline at each n char', function () { diff --git a/packages/server/test/unit/open_spec.js b/packages/server/test/unit/util/open_spec.js similarity index 92% rename from packages/server/test/unit/open_spec.js rename to packages/server/test/unit/util/open_spec.js index d69a2c01c7..05d9d1bb0a 100644 --- a/packages/server/test/unit/open_spec.js +++ b/packages/server/test/unit/util/open_spec.js @@ -1,7 +1,7 @@ -require('../spec_helper') +require('../../spec_helper') const cp = require('child_process') -const open = require(`${root}lib/util/open`) +const open = require(`${root}../lib/util/open`) const platform = (p) => { return Object.defineProperty(process, 'platform', { diff --git a/packages/server/test/unit/origin_spec.js b/packages/server/test/unit/util/origin_spec.js similarity index 85% rename from packages/server/test/unit/origin_spec.js rename to packages/server/test/unit/util/origin_spec.js index 15876e2d15..e3ac7d15e2 100644 --- a/packages/server/test/unit/origin_spec.js +++ b/packages/server/test/unit/util/origin_spec.js @@ -1,6 +1,6 @@ -require('../spec_helper') +require('../../spec_helper') -const origin = require(`${root}lib/util/origin`) +const origin = require(`${root}../lib/util/origin`) describe('lib/util/origin', () => { beforeEach(function () { diff --git a/packages/server/test/unit/path_helpers_spec.js b/packages/server/test/unit/util/path_helpers_spec.js similarity index 84% rename from packages/server/test/unit/path_helpers_spec.js rename to packages/server/test/unit/util/path_helpers_spec.js index 0704b9bbd9..8632372378 100644 --- a/packages/server/test/unit/path_helpers_spec.js +++ b/packages/server/test/unit/util/path_helpers_spec.js @@ -1,6 +1,6 @@ -require('../spec_helper') +require('../../spec_helper') -const path_helpers = require(`${root}lib/util/path_helpers`) +const path_helpers = require(`${root}../lib/util/path_helpers`) describe('lib/util/path_helpers', () => { context('checkIfResolveChangedRootFolder', () => { diff --git a/packages/server/test/unit/profile_cleaner_spec.js b/packages/server/test/unit/util/profile_cleaner_spec.js similarity index 92% rename from packages/server/test/unit/profile_cleaner_spec.js rename to packages/server/test/unit/util/profile_cleaner_spec.js index 6fa33e71a9..b6af0812bc 100644 --- a/packages/server/test/unit/profile_cleaner_spec.js +++ b/packages/server/test/unit/util/profile_cleaner_spec.js @@ -1,10 +1,10 @@ -require('../spec_helper') +require('../../spec_helper') const os = require('os') const path = require('path') -const { fs } = require(`${root}/lib/util/fs`) -const findProcess = require(`${root}lib/util/find_process`) -const profileCleaner = require(`${root}lib/util/profile_cleaner`) +const { fs } = require(`${root}../lib/util/fs`) +const findProcess = require(`${root}../lib/util/find_process`) +const profileCleaner = require(`${root}../lib/util/profile_cleaner`) const tmpDir = os.tmpdir() const pidProfilesFolder = path.join(tmpDir, 'pid-profiles') diff --git a/packages/server/test/unit/random_spec.js b/packages/server/test/unit/util/random_spec.js similarity index 88% rename from packages/server/test/unit/random_spec.js rename to packages/server/test/unit/util/random_spec.js index 4864243a7c..7270577af1 100644 --- a/packages/server/test/unit/random_spec.js +++ b/packages/server/test/unit/util/random_spec.js @@ -1,7 +1,7 @@ -require('../spec_helper') +require('../../spec_helper') const randomstring = require('randomstring') -const random = require(`${root}lib/util/random`) +const random = require(`${root}../lib/util/random`) context('.id', () => { it('returns random.generate string with length 5 by default', () => { diff --git a/packages/server/test/unit/routes_util_spec.js b/packages/server/test/unit/util/routes_spec.js similarity index 93% rename from packages/server/test/unit/routes_util_spec.js rename to packages/server/test/unit/util/routes_spec.js index bcf0e0c783..f491b61257 100644 --- a/packages/server/test/unit/routes_util_spec.js +++ b/packages/server/test/unit/util/routes_spec.js @@ -1,6 +1,6 @@ -require('../spec_helper') +require('../../spec_helper') -const { apiRoutes, onRoutes } = require(`${root}/lib/util/routes`) +const { apiRoutes, onRoutes } = require(`${root}../lib/util/routes`) describe('lib/util/routes', () => { describe('api routes', () => { diff --git a/packages/server/test/unit/specs_spec.js b/packages/server/test/unit/util/specs_spec.js similarity index 97% rename from packages/server/test/unit/specs_spec.js rename to packages/server/test/unit/util/specs_spec.js index 2f72cfb4aa..582d0eeb30 100644 --- a/packages/server/test/unit/specs_spec.js +++ b/packages/server/test/unit/util/specs_spec.js @@ -1,9 +1,9 @@ -require('../spec_helper') +require('../../spec_helper') const R = require('ramda') const path = require('path') -const config = require(`${root}lib/config`) -const specsUtil = require(`${root}lib/util/specs`).default +const config = require(`${root}../lib/config`) +const specsUtil = require(`${root}../lib/util/specs`).default const FixturesHelper = require('@tooling/system-tests/lib/fixtures') const debug = require('debug')('test') diff --git a/packages/server/test/unit/stream_buffer_spec.js b/packages/server/test/unit/util/stream_buffer_spec.js similarity index 98% rename from packages/server/test/unit/stream_buffer_spec.js rename to packages/server/test/unit/util/stream_buffer_spec.js index bfb5db3da5..c7ae9eea1b 100644 --- a/packages/server/test/unit/stream_buffer_spec.js +++ b/packages/server/test/unit/util/stream_buffer_spec.js @@ -1,11 +1,11 @@ -require('../spec_helper') +require('../../spec_helper') const _ = require('lodash') const fs = require('fs') const stream = require('stream') const Promise = require('bluebird') const { concatStream } = require('@packages/network') -const { streamBuffer } = require('../../lib/util/stream_buffer') +const { streamBuffer } = require('../../../lib/util/stream_buffer') function drain (stream) { return new Promise((resolve) => { diff --git a/packages/server/test/unit/suppress_warnings_spec.ts b/packages/server/test/unit/util/suppress_warnings_spec.ts similarity index 87% rename from packages/server/test/unit/suppress_warnings_spec.ts rename to packages/server/test/unit/util/suppress_warnings_spec.ts index 7509cf48da..bee28e6d04 100644 --- a/packages/server/test/unit/suppress_warnings_spec.ts +++ b/packages/server/test/unit/util/suppress_warnings_spec.ts @@ -1,4 +1,4 @@ -import '../spec_helper' +import '../../spec_helper' import { expect } from 'chai' import execa from 'execa' import proxyquire from 'proxyquire' @@ -6,7 +6,7 @@ import proxyquire from 'proxyquire' const ERROR_MESSAGE = 'Setting the NODE_TLS_REJECT_UNAUTHORIZED' const TLS_CONNECT = `require('tls').connect().on('error', ()=>{});` -const SUPPRESS_WARNING = `require('${__dirname}/../../lib/util/suppress_warnings').suppress();` +const SUPPRESS_WARNING = `require('${__dirname}/../../../lib/util/suppress_warnings').suppress();` describe('lib/util/suppress_warnings', function () { it('tls.connect emits warning if NODE_TLS_REJECT_UNAUTHORIZED=0 and not suppressed', function () { @@ -36,7 +36,7 @@ describe('lib/util/suppress_warnings', function () { const emitWarning = sinon.spy(process, 'emitWarning') // force typescript to always be non-requireable - const { suppress } = proxyquire('../../lib/util/suppress_warnings', {}) + const { suppress } = proxyquire('../../../lib/util/suppress_warnings', {}) suppress() diff --git a/packages/server/test/unit/terminal_spec.js b/packages/server/test/unit/util/terminal_spec.js similarity index 94% rename from packages/server/test/unit/terminal_spec.js rename to packages/server/test/unit/util/terminal_spec.js index 73e51e7a2e..3d8e6da471 100644 --- a/packages/server/test/unit/terminal_spec.js +++ b/packages/server/test/unit/util/terminal_spec.js @@ -1,11 +1,11 @@ -require('../spec_helper') +require('../../spec_helper') const snapshot = require('snap-shot-it') const stripAnsi = require('strip-ansi') const widestLine = require('widest-line') -const env = require(`${root}lib/util/env`) -const terminal = require(`${root}lib/util/terminal`) -const terminalSize = require(`${root}lib/util/terminal-size`) +const env = require(`${root}../lib/util/env`) +const terminal = require(`${root}../lib/util/terminal`) +const terminalSize = require(`${root}../lib/util/terminal-size`) const sanitizeSnapshot = (str) => { return snapshot(stripAnsi(str)) diff --git a/packages/server/test/unit/trash_spec.js b/packages/server/test/unit/util/trash_spec.js similarity index 96% rename from packages/server/test/unit/trash_spec.js rename to packages/server/test/unit/util/trash_spec.js index a8d4aecb0e..953657a2b8 100644 --- a/packages/server/test/unit/trash_spec.js +++ b/packages/server/test/unit/util/trash_spec.js @@ -1,9 +1,9 @@ -require('../spec_helper') +require('../../spec_helper') const fs = require('fs') const os = require('os') const path = require('path') -const trash = require(`${root}lib/util/trash`) +const trash = require(`${root}../lib/util/trash`) const populateDirectories = function (basePath) { fs.mkdirSync(basePath) diff --git a/packages/server/test/unit/tty_spec.js b/packages/server/test/unit/util/tty_spec.js similarity index 95% rename from packages/server/test/unit/tty_spec.js rename to packages/server/test/unit/util/tty_spec.js index df66cc0493..277e9ff4be 100644 --- a/packages/server/test/unit/tty_spec.js +++ b/packages/server/test/unit/util/tty_spec.js @@ -1,8 +1,8 @@ -require('../spec_helper') +require('../../spec_helper') const tty = require('tty') -const ttyUtil = require(`${root}lib/util/tty`) -const terminalSize = require(`${root}lib/util/terminal-size`) +const ttyUtil = require(`${root}../lib/util/tty`) +const terminalSize = require(`${root}../lib/util/terminal-size`) const ttys = [process.stdin.isTTY, process.stdout.isTTY, process.stderr.isTTY]