mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Install devDeps inside root package folder during tests
Clean them up when we're done
This commit is contained in:
parent
8d4376757a
commit
f6945792cd
18
script/test
18
script/test
@ -88,8 +88,20 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
|
||||
]
|
||||
|
||||
const pkgJsonPath = path.join(repositoryPackagePath, 'package.json')
|
||||
const nodeModulesPath = path.join(repositoryPackagePath, 'node_modules')
|
||||
const nodeModulesBackupPath = path.join(repositoryPackagePath, 'node_modules.bak')
|
||||
let finalize = () => null
|
||||
if (require(pkgJsonPath).atomTestRunner) {
|
||||
console.log(`Installing test runner dependencies for ${packageName}`.bold.green)
|
||||
if (fs.existsSync(nodeModulesPath)) {
|
||||
fs.copySync(nodeModulesPath, nodeModulesBackupPath)
|
||||
finalize = () => {
|
||||
fs.removeSync(nodeModulesPath)
|
||||
fs.renameSync(nodeModulesBackupPath, nodeModulesPath)
|
||||
}
|
||||
} else {
|
||||
finalize = () => fs.removeSync(nodeModulesPath)
|
||||
}
|
||||
runApmInstall(repositoryPackagePath)
|
||||
console.log(`Executing ${packageName} tests`.green)
|
||||
} else {
|
||||
@ -98,12 +110,16 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
|
||||
const cp = childProcess.spawn(executablePath, testArguments)
|
||||
let stderrOutput = ''
|
||||
cp.stderr.on('data', data => stderrOutput += data)
|
||||
cp.on('error', error => { callback(error) })
|
||||
cp.on('error', error => {
|
||||
finalize()
|
||||
callback(error)
|
||||
})
|
||||
cp.on('close', exitCode => {
|
||||
if (exitCode !== 0) {
|
||||
console.log(`Package tests failed for ${packageName}:`.red)
|
||||
console.log(stderrOutput)
|
||||
}
|
||||
finalize()
|
||||
callback(null, exitCode)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user