mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-21 06:29:16 -05:00
fbd523615e
* temp 07/01/19 [skip ci] main lint files * use lint-staged scripts * fix all auto-fixable eslint errors * manually fix lint issues in files * temp 07/01/19 [skip ci] * bump eslint plugin versions, update circle.yml * [lint fix] remaining js files * update vscode/settings.json * add back stop-only * use stop-only for linting .onlys * fix verify_spec, build_spec * update json plugin * relint & apply corrections * fix appveyor.yml not cleansing env vars (very bad) * dont echo commit message in appveyor script * retry build & * re-add & upgrade lint-staged * update contributing docs * only let stop-only catch staged changes
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
const la = require('lazy-ass')
|
|
const is = require('check-more-types')
|
|
const { join } = require('path')
|
|
|
|
/* eslint-env mocha */
|
|
describe('konfig check', () => {
|
|
/*
|
|
script tests should NOT suddenly change the current working directory to
|
|
packages/server - otherwise the local path filenames might be all wrong
|
|
and unexpected. The current working directory changes when we
|
|
require `packages/server/lib/konfig` which in tern requires
|
|
`lib/cwd` which changes CWD.
|
|
|
|
From the scripts unit tests we should not use `lib/konfig` directly,
|
|
instead we should use `binary/get-config` script to get the konfig function.
|
|
*/
|
|
|
|
let cwd
|
|
|
|
before(() => {
|
|
cwd = process.cwd()
|
|
la(
|
|
!cwd.includes(join('packages', 'server')),
|
|
'process CWD is set to',
|
|
cwd,
|
|
'for some reason'
|
|
)
|
|
// if the above assertion breaks, it means some script in binary scripts
|
|
// loads "lib/konfig" directly, which unexpectedly changes the CWD.
|
|
})
|
|
|
|
it('does not change CWD on load', () => {
|
|
const konfig = require('../binary/get-config')()
|
|
const cwdAfter = process.cwd()
|
|
|
|
la(
|
|
cwd === cwdAfter,
|
|
'previous cwd',
|
|
cwd,
|
|
'differs after loading konfig',
|
|
cwdAfter
|
|
)
|
|
|
|
la(is.fn(konfig), 'expected konfig to be a function', konfig)
|
|
})
|
|
})
|