-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow generator to pull private registry
- Loading branch information
1 parent
74173a7
commit e95321d
Showing
9 changed files
with
176 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Testing Private Registry | ||
|
||
on: ['pull_request'] | ||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
super-cli: ${{ steps.set-crashers-count.outputs.super-cli }} | ||
name: ci | ||
services: | ||
verdaccio: | ||
image: verdaccio/verdaccio:5 | ||
ports: | ||
- 4873:4873 | ||
steps: | ||
- uses: AutoModality/action-clean@v1 | ||
- uses: actions/[email protected] | ||
- name: Use Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- name: Install | ||
run: npm install | ||
- name: Installing login | ||
run: npm install -g npm-cli-login | ||
- name: Test | ||
run: npm test | ||
- name: credentials | ||
run: npm run login | ||
- name: Test Registry | ||
run: npm run test:registry | ||
working-directory: ./test/test-project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"npm": ">6.13.7" | ||
}, | ||
"scripts": { | ||
"login": "NPM_REGISTRY=http://localhost:4873 NPM_USER=admin NPM_PASS=nimda [email protected] npm-cli-login", | ||
"test": "npm run test:unit && npm run test:integration && npm run test:cli", | ||
"test:unit": "jest --coverage --testPathIgnorePatterns=integration --testPathIgnorePatterns=test-project", | ||
"test:dev": "npm run test:unit -- --watchAll", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
const { readFile } = require('fs').promises; | ||
const path = require('path'); | ||
const Generator = require('@asyncapi/generator'); | ||
const dummySpecPath = path.resolve(__dirname, '../docs/dummy.yml'); | ||
const crypto = require('crypto'); | ||
const mainTestResultPath = 'test/temp/integrationTestResult'; | ||
process.env['PUPPETEER_SKIP_CHROMIUM_DOWNLOAD'] = true; | ||
|
||
describe('Integration testing generateFromFile() to make sure the template can be download from the private repository.', () => { | ||
const generateFolderName = () => { | ||
//you always want to generate to new directory to make sure test runs in clear environment | ||
return path.resolve(mainTestResultPath, crypto.randomBytes(4).toString('hex')); | ||
}; | ||
|
||
jest.setTimeout(6000000); | ||
|
||
it('generated using private registory', async () => { | ||
const outputDir = generateFolderName(); | ||
const generator = new Generator('@asyncapi/html-template', outputDir, | ||
{ | ||
debug: true, | ||
install: true, | ||
forceWrite: true, | ||
templateParams: { | ||
singleFile: true | ||
}, | ||
registry: { | ||
url: 'http://127.0.0.1:4873', // Replace the host.docker.internal to localhost for testing without docker | ||
auth: 'YWRtaW46bmltZGE=' // base64 encoded username and password represented as admin:nimda | ||
|
||
} | ||
}); | ||
try { | ||
await generator.generateFromFile(dummySpecPath); | ||
// Code to run if the method call is successful | ||
} catch (error) { | ||
// Code to handle the error | ||
console.error('An error occurred:', error); | ||
} | ||
|
||
const file = await readFile(path.join(outputDir, 'index.html'), 'utf8'); | ||
expect(file).toContain('Dummy example with all spec features included'); | ||
}); | ||
}); |