diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 19c65c62..5cfc7f58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,7 +75,7 @@ test:unit:utils: #Integration Tests .test:integration: &integration image: - name: docker/compose:latest + name: jdalrymple/docker-compose-with-node entrypoint: ['/bin/sh', '-c'] variables: DOCKER_HOST: tcp://docker:2375 @@ -83,10 +83,8 @@ test:unit:utils: services: - docker:dind stage: test + retry: 2 before_script: - # Install docker compose - - apk add --no-cache nodejs yarn git - # Spin up container - cd scripts - docker-compose -f docker-compose.yml up -d @@ -98,26 +96,25 @@ test:unit:utils: - export PERSONAL_ACCESS_TOKEN=$(docker exec -i gitlab sh -c 'gitlab-rails r /mnt/init.rb') - cd .. - - echo $PERSONAL_ACCESS_TOKEN - - echo $GITLAB_URL - - echo $CODECOV_TOKEN + after_script: + - docker cp gitlab:/var/log/gitlab runner_logs + - echo $(docker exec -i gitlab sh -c "grep -v -e '^#' -e '^$' /etc/gitlab/gitlab.rb") > runner_logs/gitlab.rb + artifacts: + when: on_failure + paths: + - runner_logs test:integration:browser: image: buildkite/puppeteer stage: test script: yarn jest browser/test/integration -test:integration:node:src: +test:integration:node: <<: *integration - script: yarn jest node/test/integration && yarn codecov -F node - -test:integration:node:dist-cjs: - <<: *integration - script: yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' - -test:integration:node:dist-es: - <<: *integration - script: yarn jest node/test/integration --moduleNameMapper='{"src":"/dist/index.js"}' + script: + - yarn test:integration:node && yarn codecov -F node + - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.js"}' + # - yarn test:integration:node --moduleNameMapper='{"src":"/dist/index.es.js"}' Requires module identifier # Canary canary: diff --git a/package.json b/package.json index 49845077..9dcc6dad 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "lint-staged": "^10.4.2", "prettier": "^2.1.2", "ts-jest": "^26.4.1", - "typescript": "^4.0.3" + "typescript": "^4.0.3", + "uuid": "^8.3.2" }, "private": true, "workspaces": [ @@ -41,6 +42,7 @@ "lint:doc:fix": "prettier --write './*.json' './*.yml' './*.md' './*.js'", "lint:fix": "prettier --write 'packages/**/{src,test}/**/*.ts' && eslint 'packages/**/{src,test}/**/*/*.ts' --fix", "test:integration": "jest test/integration", + "test:integration:node": "TEST_ID=$(uuid) yarn jest node/test/integration", "test:unit": "jest test/unit", "release": "auto shipit --verbose --verbose" }, diff --git a/packages/gitbeaker-node/test/integration/services/Issues.ts b/packages/gitbeaker-node/test/integration/services/Issues.ts index 3b65c548..0c0a507f 100644 --- a/packages/gitbeaker-node/test/integration/services/Issues.ts +++ b/packages/gitbeaker-node/test/integration/services/Issues.ts @@ -1,5 +1,6 @@ import { Issues, Projects } from '../../../src'; +const { TEST_ID } = process.env; let issueAPI: InstanceType; let projectAPI: InstanceType; @@ -16,7 +17,7 @@ beforeAll(async () => { describe.skip('Issues.all', () => { beforeAll(async () => { - const project = await projectAPI.create({ name: 'Issues All Integration Test' }); + const project = await projectAPI.create({ name: `Issues All Integration Test ${TEST_ID}` }); const newIssues: any[] = []; for (let i = 0; i < 100; i += 1) { diff --git a/packages/gitbeaker-node/test/integration/services/Projects.ts b/packages/gitbeaker-node/test/integration/services/Projects.ts index c76c871b..d4547fd2 100644 --- a/packages/gitbeaker-node/test/integration/services/Projects.ts +++ b/packages/gitbeaker-node/test/integration/services/Projects.ts @@ -1,5 +1,6 @@ import { Projects } from '../../../src'; +const { TEST_ID } = process.env; let service: InstanceType; beforeEach(() => { @@ -11,10 +12,10 @@ beforeEach(() => { describe('Projects.create', () => { it('should create a valid project', async () => { - const p = await service.create({ name: 'Project Creation Integration Test' }); + const p = await service.create({ name: `Project Creation Integration Test ${TEST_ID}` }); expect(p).toBeInstanceOf(Object); - expect(p.name).toEqual('Project Creation Integration Test'); + expect(p.name).toEqual(`Project Creation Integration Test ${TEST_ID}`); }); }); @@ -23,7 +24,7 @@ describe.skip('Projects.all', () => { const newProjects: any[] = []; for (let i = 0; i < 100; i += 1) { - newProjects.push(service.create({ name: `Project All Integration Test${i}` })); + newProjects.push(service.create({ name: `Project All Integration Test ${TEST_ID} ${i}` })); } await Promise.all(newProjects); @@ -40,7 +41,9 @@ describe.skip('Projects.all', () => { describe('Projects.upload', () => { it('should upload a text file', async () => { try { - const project = await service.create({ name: 'Project Upload Integration Test Text File' }); + const project = await service.create({ + name: `Project Upload Integration Test Text File ${TEST_ID}`, + }); const results = await service.upload(project.id as number, 'TESTING FILE UPLOAD :D', { metadata: { filename: 'testfile.txt', diff --git a/yarn.lock b/yarn.lock index 70d5764e..b5139740 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10312,7 +10312,7 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0: +uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==