mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
📚 Update development cycle documentation and add placeholder tests
This commit is contained in:
parent
9630615fc7
commit
97893fed1b
|
@ -42,10 +42,7 @@ dependencies are installed and the packages get linked correctly. Here a short g
|
|||
|
||||
#### Build Tools
|
||||
|
||||
That all the packages which n8n uses can be installed and compiled correctly
|
||||
the essential build tools must be installed. This is probably already the case
|
||||
for the most people but if you are totally new to development or just setting
|
||||
up a new computer it is probably still missing.
|
||||
The packages which n8n uses depend on a few build tools:
|
||||
|
||||
Linux:
|
||||
```
|
||||
|
@ -60,7 +57,7 @@ npm install -g windows-build-tools
|
|||
#### lerna
|
||||
|
||||
n8n is split up in different modules which are all in a single mono repository.
|
||||
To make development as easy as possible does [lerna](https://lerna.js.org) get
|
||||
To facilitate those modules management, [lerna](https://lerna.js.org) gets
|
||||
used. It automatically sets up file-links between modules which depend on each
|
||||
other.
|
||||
|
||||
|
@ -81,17 +78,17 @@ checked out and set up:
|
|||
git clone https://github.com/n8n-io/n8n.git
|
||||
```
|
||||
|
||||
2. Go into repository folder
|
||||
1. Go into repository folder
|
||||
```
|
||||
cd n8n
|
||||
```
|
||||
|
||||
3. Install all dependencies of all modules and link them together:
|
||||
1. Install all dependencies of all modules and link them together:
|
||||
```
|
||||
lerna bootstrap --hoist
|
||||
```
|
||||
|
||||
4. Build all the code:
|
||||
1. Build all the code:
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
@ -109,13 +106,35 @@ npm run start
|
|||
|
||||
## Development Cycle
|
||||
|
||||
While iterating on n8n modules' code, you can run `npm run watch` to automatically build your changes. This will alert you as soon as something gets broken.
|
||||
While iterating on n8n modules code, you can run `npm run dev`. It will then
|
||||
automatically build your code, restart the backend and refresh the frontend
|
||||
(editor-ui) on every change you make.
|
||||
|
||||
1. `npm run watch`
|
||||
1. Start n8n in development mode:
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
1. hack, hack, hack
|
||||
1. `npm run start`
|
||||
1. test
|
||||
1. Check if everything still runs in production mode
|
||||
```
|
||||
npm run build
|
||||
npm run start
|
||||
```
|
||||
1. Create tests
|
||||
1. Run all tests
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
1. Commit code and create pull request
|
||||
|
||||
|
||||
### Test suite
|
||||
|
||||
TODO: how to run jest or other automated test tools
|
||||
The tests can be started via:
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
|
||||
If that gets executed in one of the package folders it will only run the tests
|
||||
of this package. If it gets executed in the n8n-root folder it will run all
|
||||
tests of all packages.
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"build": "lerna exec npm run build",
|
||||
"dev": "lerna exec npm run dev --parallel",
|
||||
"start": "cd packages/cli && node dist/index.js start",
|
||||
"test": "lerna run test",
|
||||
"watch": "lerna run --parallel watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
7
packages/cli/test/placeholder.test.ts
Normal file
7
packages/cli/test/placeholder.test.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
describe('Placeholder', () => {
|
||||
|
||||
test('example', () => {
|
||||
expect(1 + 1).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
|
@ -16,6 +16,7 @@
|
|||
"dev": "npm run serve",
|
||||
"lint": "vue-cli-service lint",
|
||||
"serve": "VUE_APP_URL_BASE_API=http://localhost:5678/ vue-cli-service serve",
|
||||
"test": "npm run test:unit",
|
||||
"tslint": "tslint -p tsconfig.json -c tslint.json",
|
||||
"test:e2e": "vue-cli-service test:e2e",
|
||||
"test:unit": "vue-cli-service test:unit"
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// import { shallowMount } from '@vue/test-utils';
|
||||
// import HelloWorld from '@/components/HelloWorld.vue';
|
||||
|
||||
// describe('HelloWorld.vue', () => {
|
||||
// it('renders props.msg when passed', () => {
|
||||
// const msg = 'new message';
|
||||
// const wrapper = shallowMount(HelloWorld, {
|
||||
// propsData: { msg }
|
||||
// });
|
||||
// expect(wrapper.text()).toMatch(msg);
|
||||
// });
|
||||
// });
|
5
packages/editor-ui/tests/unit/placeholder.spec.ts
Normal file
5
packages/editor-ui/tests/unit/placeholder.spec.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
describe('Placeholder.vue', () => {
|
||||
it('example', () => {
|
||||
expect(1 + 1).toEqual(2);
|
||||
});
|
||||
});
|
|
@ -16,6 +16,7 @@
|
|||
"scripts": {
|
||||
"dev": "npm run watch",
|
||||
"build": "tsc",
|
||||
"test": "jest",
|
||||
"tslint": "tslint -p tsconfig.json -c tslint.json",
|
||||
"watch": "tsc --watch"
|
||||
},
|
||||
|
@ -45,5 +46,23 @@
|
|||
"replace-in-file": "^4.1.0",
|
||||
"typescript": "~3.5.2",
|
||||
"vorpal": "^1.12.0"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testURL": "http://localhost/",
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"testPathIgnorePatterns": [
|
||||
"/dist/",
|
||||
"/node_modules/"
|
||||
],
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"json",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
7
packages/node-dev/test/placeholder.test.ts
Normal file
7
packages/node-dev/test/placeholder.test.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
describe('Placeholder', () => {
|
||||
|
||||
test('example', () => {
|
||||
expect(1 + 1).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
|
@ -4,7 +4,8 @@
|
|||
"es2017"
|
||||
],
|
||||
"types": [
|
||||
"node"
|
||||
"node",
|
||||
"jest"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
|
@ -26,6 +27,7 @@
|
|||
],
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules/**/*",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
|
|
7
packages/nodes-base/test/placeholder.test.ts
Normal file
7
packages/nodes-base/test/placeholder.test.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
describe('Placeholder', () => {
|
||||
|
||||
test('example', () => {
|
||||
expect(1 + 1).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in a new issue