Browse Source

fix flacky tests

pull/24/head
Nicolas Beaussart 6 years ago
parent
commit
b323246c80
No known key found for this signature in database GPG Key ID: 51D5A407BFCE64A9
  1. 6
      src/tests/add/prettier.spec.ts
  2. 6
      src/tests/add/tailwind.spec.ts
  3. 14
      src/utls/base-add-command.spec.ts

6
src/tests/add/prettier.spec.ts

@ -20,10 +20,6 @@ beforeEach(async () => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
try {
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
} catch {}
});
afterEach(() => {
console.log = originalLog;
@ -40,7 +36,7 @@ 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"');
await system.run('git commit -m "init state" --author="Dummy <dummy@noop.noop>');
};
describe('prettier', () => {

6
src/tests/add/tailwind.spec.ts

@ -20,10 +20,6 @@ beforeEach(async () => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
try {
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
} catch {}
});
afterEach(() => {
console.log = originalLog;
@ -40,7 +36,7 @@ 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"');
await system.run('git commit -m "init state" --author="Dummy <dummy@noop.noop>');
};
describe('tailwind', () => {

14
src/utls/base-add-command.spec.ts

@ -18,10 +18,6 @@ beforeEach(async () => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
try {
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
} catch {}
});
afterEach(() => {
console.log = originalLog;
@ -58,7 +54,7 @@ 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"');
await system.run('git commit -m "init state" --author="Dummy <dummy@noop.noop>"');
};
describe('BaseAddCommand', () => {
@ -128,7 +124,7 @@ describe('BaseAddCommand', () => {
'touch test.md',
'git add test.md',
'git add .nbxrc',
'git commit -m "test commit"',
'git commit -m "test commit" --author="Dummy <dummy@noop.noop>',
'echo hello > test.md',
],
},
@ -138,7 +134,7 @@ describe('BaseAddCommand', () => {
'touch test.md',
'git add test.md',
'git add .nbxrc',
'git commit -m "test commit"',
'git commit -m "test commit" --author="Dummy <dummy@noop.noop>',
'rm -f test.md',
],
},
@ -179,7 +175,7 @@ describe('BaseAddCommand', () => {
await system.run('git init');
await system.run('git add .nbxrc');
await system.run('pwd');
await system.run('git commit -m "initial commit"');
await system.run('git commit -m "initial commit" --author="Dummy <dummy@noop.noop>');
await system.run('git status');
await RunCommand.run(['initGit']);
const gitConfig = filesystem.read('.git/config');
@ -252,7 +248,7 @@ 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"');
await system.run('git commit -m "test" --author="Dummy <dummy@noop.noop>');
const before = await system.run('git status -s');
await RunCommand.run(['gitAddUnstaged']);

Loading…
Cancel
Save