Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed tests and added build task to all branches in circleci #515

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "package.json" }}
paths: ./node_modules

- run:
name: Show installed npm dependencies
command: npm list --depth=1 || true
Expand Down Expand Up @@ -63,7 +62,7 @@ workflows:
- build:
filters:
tags:
ignore: /.*/
ignore: /^v.*/
build-publish-tag:
jobs:
- build:
Expand Down
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function lintWatch() {
function runTest() {
process.env.NODE_ENV = 'test';
return src('test/')// using src('test/**/*.js') will cause the task to be run twice
// TODO: why do we want to accept failing tests? gulp-plumber prevents pipe breaking caused by errors from gulp plugins
.pipe(plumber())
.pipe(jest());
}
Expand All @@ -32,5 +33,5 @@ exports.test = runTest;
exports.testWatch = series(runTest, testWatch);
exports.lint = lint;
exports.lintWatch = series(lint, lintWatch);
exports.prepublish = series(lint);
exports.prepublish = series(lint, runTest);
exports.default = series(lint, runTest);
5 changes: 3 additions & 2 deletions test/init-app-slib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ describe('generate app-slib plugin with prompt `app: appName` and the rest defau
assert.jsonFileContent('package.json', {types: initWebPackage.types});
});

it('generates `.gitignore` that has no `/dist/` entry', () => {
assert.noFileContent('.gitignore', '/dist/');
it('generates `.gitignore` that has no `/dist/` but a `/dist/tsBuildInfoFile` entry', () => {
assert.noFileContent('.gitignore', '/dist/\n');
assert.fileContent('.gitignore', '/dist/tsBuildInfoFile\n');
});

it('generates `tsconfig.json` with correct content', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/init-app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ describe('generate app plugin with prompt `app: appName` and the rest default pr
assert.jsonFileContent('package.json', {types: initWebPackage.types});
});

it('generates `.gitignore` that has no `/dist/` entry', () => {
assert.noFileContent('.gitignore', '/dist/');
it('generates `.gitignore` that has no `/dist/` but a `/dist/tsBuildInfoFile` entry', () => {
assert.noFileContent('.gitignore', '/dist/\n');
assert.fileContent('.gitignore', '/dist/tsBuildInfoFile\n');
});

it('generates `tsconfig.json` with correct content', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/init-lib-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ describe('generate lib-service plugin with default prompt values', () => {
assert.jsonFileContent('package.json', {types: initWebPackage.types});
});

it('generates `.gitignore` that has no `/dist/` entry', () => {
assert.noFileContent('.gitignore', '/dist/');
it('generates `.gitignore` that has no `/dist/` but a `/dist/tsBuildInfoFile` entry', () => {
assert.noFileContent('.gitignore', '/dist/\n');
assert.fileContent('.gitignore', '/dist/tsBuildInfoFile\n');
});

it('generates `tsconfig.json` with correct content', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/init-lib-slib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ describe('generate lib-slib plugin with default prompt values', () => {
assert.jsonFileContent('package.json', {types: initWebPackage.types});
});

it('generates `.gitignore` that has no `/dist/` entry', () => {
assert.noFileContent('.gitignore', '/dist/');
it('generates `.gitignore` that has no `/dist/` but a `/dist/tsBuildInfoFile` entry', () => {
assert.noFileContent('.gitignore', '/dist/\n');
assert.fileContent('.gitignore', '/dist/tsBuildInfoFile\n');
});

it('generates `tsconfig.json` with correct content', () => {
Expand Down
5 changes: 3 additions & 2 deletions test/init-lib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ describe('Generate lib plugin with default prompt values', () => {
assert.jsonFileContent('package.json', {types: initWebPackage.types});
});

it('generates `.gitignore` that has no `/dist/` entry', () => {
assert.noFileContent('.gitignore', '/dist/');
it('generates `.gitignore` that has no `/dist/` but a `/dist/tsBuildInfoFile` entry', () => {
assert.noFileContent('.gitignore', '/dist/\n');
assert.fileContent('.gitignore', '/dist/tsBuildInfoFile\n');
});

it('generates `tsconfig.json` with correct content', () => {
Expand Down
6 changes: 3 additions & 3 deletions test/setup-workspace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const dependencies = require('./test-utils/generator-dependencies');
/**
* Directory name to run the generator
*/
const target = '../phovea_workpsace';
const target = '../phovea_workspace';

const product = 'org/dummy_product';

Expand Down Expand Up @@ -53,8 +53,8 @@ describe('generator setup-workspace', () => {
// rimraf.sync(path.join(__dirname, target));
// });

it('calls WorkspaceUtils.cloneRepo(...args) 13 times (1 product + 12 plugins)', () => {
expect(WorkspaceUtils.cloneRepo.mock.calls.length).toBe(13);
it('calls WorkspaceUtils.cloneRepo(...args) 7 times (1 product + 6 plugins defined in phovea_product_dummy.json)', () => {
expect(WorkspaceUtils.cloneRepo.mock.calls.length).toBe(7);
});

it('clones product by calling `WorkspaceUtils.cloneRepo(...args)` with the correct args', () => {
Expand Down