Browse Source

fix tests

pull/5/head
Nicolas Beaussart 6 years ago
parent
commit
0c084de06c
No known key found for this signature in database GPG Key ID: 51D5A407BFCE64A9
  1. 2
      .circleci/config.yml
  2. 4
      src/tests/add/prettier.spec.ts
  3. 4
      src/tests/add/tailwind.spec.ts
  4. 28
      src/utls/__snapshots__/base-add-command.spec.ts.snap
  5. 8
      src/utls/base-add-command.spec.ts

2
.circleci/config.yml

@ -22,7 +22,7 @@ jobs:
- run: ./bin/run --help
- run:
name: Testing
command: yarn test
command: yarn test --ci
- run:
name: Sending to codecov
command: yarn codecov

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

@ -12,7 +12,7 @@ let execPath: string;
const originalCwd = process.cwd();
const originalLog = console.log;
beforeEach(() => {
beforeEach(async () => {
consoleLogOutput = [];
console.log = (x: any) => consoleLogOutput.push(stripANSI(x));
@ -20,6 +20,8 @@ beforeEach(() => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
});
afterEach(() => {
console.log = originalLog;

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

@ -12,7 +12,7 @@ let execPath: string;
const originalCwd = process.cwd();
const originalLog = console.log;
beforeEach(() => {
beforeEach(async () => {
consoleLogOutput = [];
console.log = (x: any) => consoleLogOutput.push(stripANSI(x));
@ -20,6 +20,8 @@ beforeEach(() => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
});
afterEach(() => {
console.log = originalLog;

28
src/utls/__snapshots__/base-add-command.spec.ts.snap

@ -56,30 +56,8 @@ exports[`BaseAddCommand addDevDependency should add the dependancy without git 2
exports[`BaseAddCommand gitAddUnstaged should add uncommited changes 1`] = `
"A .nbxrc
A test.11.md
A test.12.md
A test.13.md
A test.14.md
A test.15.md
A test.21.md
A test.22.md
A test.23.md
A test.24.md
A test.25.md
A test.31.md
A test.32.md
A test.33.md
A test.34.md
A test.35.md
A test.41.md
A test.42.md
A test.43.md
A test.44.md
A test.45.md
A test.51.md
A test.52.md
A test.53.md
A test.54.md
A test.55.md
A test.1.md
A test.2.md
A test.3.md
"
`;

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

@ -10,7 +10,7 @@ let execPath: string;
const originalCwd = process.cwd();
const originalLog = console.log;
beforeEach(() => {
beforeEach(async () => {
consoleLogOutput = [];
console.log = (x: any) => consoleLogOutput.push(stripANSI(x));
@ -18,6 +18,8 @@ beforeEach(() => {
execPath = filesystem.path('/', 'tmp', tmpDirName);
filesystem.dir(execPath);
process.chdir(execPath);
await system.run('git config --global user.email "you@example.com"');
await system.run('git config --global user.name "Your Name"');
});
afterEach(() => {
console.log = originalLog;
@ -259,7 +261,9 @@ describe('BaseAddCommand', () => {
it('should add uncommited changes', async () => {
await system.run('git init');
filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } });
await system.run('touch test.{1,2,3,4,5}{1,2,3,4,5}.md');
await system.run('touch test.1.md');
await system.run('touch test.2.md');
await system.run('touch test.3.md');
await RunCommand.run(['gitAddUnstaged']);

Loading…
Cancel
Save