Skip to content

Commit

Permalink
test: fix some failures (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig authored Jun 27, 2022
1 parent 366e701 commit 21824ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"lint:markdown": "markdownlint \"**/*.md\" --dot --ignore-path \".gitignore\"",
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"test:unit": "tap",
"test:e2e-docker": "tap \"./build/e2e/docker.test.e2e.js\"",
"test:e2e-classic": "tap \"./build/e2e/classic.test.e2e.js\"",
"test:unit": "tap --test-env=NODE_ENV=test",
"test:e2e-docker": "tap \"./build/e2e/docker.test.e2e.js\" --test-env=NODE_ENV=test",
"test:e2e-classic": "tap \"./build/e2e/classic.test.e2e.js\" --test-env=NODE_ENV=test",
"release": "semantic-release"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/tests/1-create-birth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const test1CreateBirth = async (
t.equal(await isExistingFile(Leon.DEFAULT_BIRTH_PATH), false)
const result = await execa(
'leon',
['create', 'birth', '--yes', '--develop', ...commandOptions],
['create', 'birth', '--yes', ...commandOptions],
{ stdio: 'inherit' }
)
t.equal(result.exitCode, 0)
Expand Down
3 changes: 3 additions & 0 deletions src/services/LeonInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export class LeonInstance implements LeonInstanceOptions {

public async runScript(options: RunNpmScriptOptions): Promise<void> {
const { command, loader, workingDirectory, verbose = false } = options
if (process.env.NODE_ENV === 'test') {
console.log(`Working directory: ${workingDirectory}`)
}
process.chdir(workingDirectory)
const runLoader = ora(loader.message).start()
try {
Expand Down
3 changes: 3 additions & 0 deletions src/services/Log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class Log {
console.error(
`For further information, look at the log file located at ${Log.errorsConfig.path}`
)
if (process.env.NODE_ENV === 'test') {
console.error(data)
}
Log.errorsConfig.set('errors', data)
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/services/Requirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ class Requirements {
const commandPath = path.join(scriptsPath, ...scriptCommand)
try {
if (sudo && !isMacOS) {
await sudoExec(commandPath)
if (process.env.NODE_ENV !== 'test') {
await sudoExec(commandPath)
} else {
await execaCommand(`sudo --non-interactive ${commandPath}`)
}
} else {
await execaCommand(commandPath)
}
Expand Down

0 comments on commit 21824ad

Please sign in to comment.