From fb1cace7c8c0f0eab6c3f55ca0c73d141036172f Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 11:06:43 +0100 Subject: [PATCH] :white_check_mark: fix tests --- src/tests/add/prettier.spec.ts | 8 ++++++-- src/tests/add/tailwind.spec.ts | 8 ++++++-- src/tests/wall.spec.ts | 2 +- src/utls/base-add-command.spec.ts | 27 +++++++++++++++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/tests/add/prettier.spec.ts b/src/tests/add/prettier.spec.ts index 5761534..6d1ac73 100644 --- a/src/tests/add/prettier.spec.ts +++ b/src/tests/add/prettier.spec.ts @@ -4,7 +4,7 @@ import * as prompts from 'prompts'; import * as latestVersion from 'latest-version'; import Prettier from '../../commands/add/prettier'; -jest.setTimeout(30000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; @@ -36,7 +36,11 @@ const initWithConfigAndCommit = async () => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('prettier', () => { diff --git a/src/tests/add/tailwind.spec.ts b/src/tests/add/tailwind.spec.ts index 00dc709..37c6068 100644 --- a/src/tests/add/tailwind.spec.ts +++ b/src/tests/add/tailwind.spec.ts @@ -4,7 +4,7 @@ import * as prompts from 'prompts'; import * as latestVersion from 'latest-version'; import Tailwind from '../../commands/add/tailwind'; -jest.setTimeout(60000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; @@ -36,7 +36,11 @@ const initWithConfigAndCommit = async (packageJson = {}) => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('tailwind', () => { diff --git a/src/tests/wall.spec.ts b/src/tests/wall.spec.ts index fea7f0f..fce8218 100644 --- a/src/tests/wall.spec.ts +++ b/src/tests/wall.spec.ts @@ -2,7 +2,7 @@ import { filesystem } from 'gluegun'; import Wall from '../commands/wall'; const stripANSI = require('strip-ansi'); -jest.setTimeout(30000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; let execPath: string; diff --git a/src/utls/base-add-command.spec.ts b/src/utls/base-add-command.spec.ts index a7730a2..58c27b3 100644 --- a/src/utls/base-add-command.spec.ts +++ b/src/utls/base-add-command.spec.ts @@ -54,7 +54,11 @@ const initWithConfigAndCommit = async () => { filesystem.write('package.json', {}); await system.run('touch yarn.lock'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('BaseAddCommand', () => { @@ -124,7 +128,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy "', + 'git commit -m "test commit"', 'echo hello > test.md', ], }, @@ -134,7 +138,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy "', + 'git commit -m "test commit"', 'rm -f test.md', ], }, @@ -144,6 +148,10 @@ describe('BaseAddCommand', () => { it(`should erro when ${action.name}`, async () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('git init'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} for (const step of action.actions) { // eslint-disable-next-line no-await-in-loop await system.run(step); @@ -174,8 +182,11 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('git init'); await system.run('git add .nbxrc'); - await system.run('pwd'); - await system.run('git commit -m "initial commit" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "initial commit"'); await system.run('git status'); await RunCommand.run(['initGit']); const gitConfig = filesystem.read('.git/config'); @@ -248,7 +259,11 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('touch test.md'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "test" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "test"'); const before = await system.run('git status -s'); await RunCommand.run(['gitAddUnstaged']);