Skip to content

Commit

Permalink
Update dependencies and let test be launched in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnuk committed Sep 5, 2022
1 parent 4eabae9 commit eda73e2
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 314 deletions.
608 changes: 310 additions & 298 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tikui/cli",
"version": "2.0.3",
"version": "2.0.4",
"description": "Command lines tool for Tikui",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -53,7 +53,7 @@
"eslint": "^8.18.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jest": "^27.0.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"eslint-plugin-react-hooks": "^4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/cli/generate-project/templated/gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.idea
/cache
/.tikui-cache
/node_modules
/dist
/build
Expand Down
2 changes: 1 addition & 1 deletion src/cli/generate-project/templated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"prepare": "husky install"
},
"dependencies": {
"@tikui/core": "^2.1.0",
"@tikui/core": "^3.0.0",
"@types/concurrently": "^7.0.0",
"tikuidoc-tikui": "^4.0.0"
},
Expand Down
11 changes: 8 additions & 3 deletions test/cli/create-component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as fs from 'fs';
import * as path from 'path';
import { createComponent } from '@/cli/create-component';
import { FAKE_DIR, FAKE_SRC_DIR, removeFakeDir, resetFakeDir } from './fake-dir.fixture';
import { fakeDir, fakeSrcDir, removeFakeDir, resetFakeDir } from './fake-dir.fixture';

const FEATURE = 'create-component';

const FAKE_DIR = fakeDir(FEATURE);
const FAKE_SRC_DIR = fakeSrcDir(FEATURE);

const pathTo = (folderPath: string) => (...segments: string[]): string => path.resolve(FAKE_DIR, `${folderPath}`, ...segments);

Expand Down Expand Up @@ -33,9 +38,9 @@ const componentWithSeparatedNameFiles = () => ({
});

describe('CLI tests', () => {
beforeEach(() => resetFakeDir());
beforeEach(() => resetFakeDir(FEATURE));

afterAll(() => removeFakeDir());
afterAll(() => removeFakeDir(FEATURE));

it('Should create directory component under src and its files', () => {
// When
Expand Down
12 changes: 6 additions & 6 deletions test/cli/fake-dir.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import * as path from 'path';
import * as rimraf from 'rimraf';
import * as fse from 'fs-extra';

export const FAKE_DIR = path.resolve(__dirname, 'tmp');
export const FAKE_SRC_DIR = path.resolve(FAKE_DIR, 'src');
export const fakeDir = (feature: string) => path.resolve(__dirname, 'tmp', feature);
export const fakeSrcDir = (feature: string) => path.resolve(fakeDir(feature), 'src');

export const removeFakeDir = (): void => rimraf.sync(FAKE_DIR);
export const removeFakeDir = (feature: string): void => rimraf.sync(fakeDir(feature));

export const resetFakeDir = (): void => {
removeFakeDir();
fse.ensureDirSync(FAKE_SRC_DIR);
export const resetFakeDir = (feature: string): void => {
removeFakeDir(feature);
fse.ensureDirSync(fakeSrcDir(feature));
};
10 changes: 7 additions & 3 deletions test/cli/generate-project.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import * as fs from 'fs';
import * as path from 'path';
import { FAKE_DIR, removeFakeDir, resetFakeDir } from './fake-dir.fixture';
import { fakeDir, removeFakeDir, resetFakeDir } from './fake-dir.fixture';
import { generateProject } from '@/cli/generate-project';
import { ExpectSame, expectSameBinaryFile, expectSameTextFile } from './file.fixture';

const FEATURE = 'generate-project';

const FAKE_DIR = fakeDir(FEATURE);

const pathTo = (folderPath: string) => (...segments: string[]): string => path.resolve(FAKE_DIR, `${folderPath}`, ...segments);

const GENERATE_PROJECT_PATH = path.resolve(__dirname, '../../src/cli/generate-project');
Expand Down Expand Up @@ -58,9 +62,9 @@ const expectAssetCreatedFor = (name: string) => {
};

describe('CLI tests', () => {
beforeEach(() => resetFakeDir());
beforeEach(() => resetFakeDir(FEATURE));

afterAll(() => removeFakeDir());
afterAll(() => removeFakeDir(FEATURE));

it.each(['project', 'my-awesome_project2'])('Should create project under project name directory and its files for %s', (name) => {
generateProject(FAKE_DIR, name);
Expand Down

0 comments on commit eda73e2

Please sign in to comment.