0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

build: fix node version issue on ci (#2140)

* build: fix node version issue

* chore: fix test on node 15
This commit is contained in:
Juan Picado 2021-03-26 18:04:19 +01:00 committed by GitHub
parent c724ccd331
commit 4f3afa33a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 100 deletions

View file

@ -59,7 +59,7 @@
"camelcase": "off",
"guard-for-in": "error",
"new-cap": "error",
"max-len": ["error", 160],
"max-len": ["error", 180],
"no-console": ["error", { "allow": ["warn"] }],
"no-constant-condition": "error",
"no-debugger": "error",

View file

@ -18,7 +18,7 @@ jobs:
- name: Use Node ${{ matrix.node_version }}
uses: actions/setup-node@v2.1.5
with:
node_version: ${{ matrix.node_version }}
node-version: ${{ matrix.node_version }}
- name: Install
run: yarn install --immutable
- name: Build

View file

@ -18,7 +18,7 @@ jobs:
- name: Use Node ${{ matrix.node_version }}
uses: actions/setup-node@v2.1.5
with:
node_version: ${{ matrix.node_version }}
node-version: ${{ matrix.node_version }}
- name: Install
run: yarn install --immutable
- name: Build

View file

@ -18,7 +18,7 @@ jobs:
- name: Use Node ${{ matrix.node_version }}
uses: actions/setup-node@v2.1.5
with:
node_version: ${{ matrix.node_version }}
node-version: ${{ matrix.node_version }}
- name: Install
run: yarn install --immutable
- name: Build

View file

@ -14,7 +14,7 @@ jobs:
- name: Use Node (latest)
uses: actions/setup-node@v2.1.5
with:
node_version: 14
node-version: 14
- name: Install
run: yarn install
- name: Build

View file

@ -19,8 +19,8 @@ jest.mock('../../../../src/lib/logger', () => ({
trace: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
fatal: jest.fn()
}
fatal: jest.fn(),
},
}));
describe('startServer via API', () => {
@ -35,13 +35,7 @@ describe('startServer via API', () => {
const version = '1.0.0';
const port = '6000';
await startServer(
config(),
port,
store,
version,
serverName,
(webServer, addrs, pkgName, pkgVersion) => {
await startServer(config(), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
expect(webServer).toBeDefined();
expect(addrs).toBeDefined();
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
@ -52,8 +46,7 @@ describe('startServer via API', () => {
expect(pkgVersion).toBe(version);
expect(pkgName).toBe(serverName);
done();
}
);
});
});
test('should set keepAliveTimeout to 0 seconds', async (done) => {
@ -62,13 +55,7 @@ describe('startServer via API', () => {
const version = '1.0.0';
const port = '6100';
await startServer(
config(parseConfigurationFile('server/keepalivetimeout-0')),
port,
store,
version,
serverName,
(webServer, addrs, pkgName, pkgVersion) => {
await startServer(config(parseConfigurationFile('server/keepalivetimeout-0')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
expect(webServer).toBeDefined();
expect(webServer.keepAliveTimeout).toBeDefined();
expect(webServer.keepAliveTimeout).toBe(0);
@ -81,8 +68,7 @@ describe('startServer via API', () => {
expect(pkgVersion).toBe(version);
expect(pkgName).toBe(serverName);
done();
}
);
});
});
test('should set keepAliveTimeout to 60 seconds', async (done) => {
@ -91,13 +77,7 @@ describe('startServer via API', () => {
const version = '1.0.0';
const port = '6200';
await startServer(
config(parseConfigurationFile('server/keepalivetimeout-60')),
port,
store,
version,
serverName,
(webServer, addrs, pkgName, pkgVersion) => {
await startServer(config(parseConfigurationFile('server/keepalivetimeout-60')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
expect(webServer).toBeDefined();
expect(webServer.keepAliveTimeout).toBeDefined();
expect(webServer.keepAliveTimeout).toBe(60000);
@ -110,8 +90,7 @@ describe('startServer via API', () => {
expect(pkgVersion).toBe(version);
expect(pkgName).toBe(serverName);
done();
}
);
});
});
test('should set keepAliveTimeout to 5 seconds per default', async (done) => {
@ -120,13 +99,7 @@ describe('startServer via API', () => {
const version = '1.0.0';
const port = '6300';
await startServer(
config(parseConfigurationFile('server/keepalivetimeout-undefined')),
port,
store,
version,
serverName,
(webServer, addrs, pkgName, pkgVersion) => {
await startServer(config(parseConfigurationFile('server/keepalivetimeout-undefined')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
expect(webServer).toBeDefined();
expect(webServer.keepAliveTimeout).toBeDefined();
expect(webServer.keepAliveTimeout).toBe(5000);
@ -139,31 +112,25 @@ describe('startServer via API', () => {
expect(pkgVersion).toBe(version);
expect(pkgName).toBe(serverName);
done();
}
);
});
});
test('should provide all HTTPS server fails', async (done) => {
test('should provide all HTTPS server fails', async () => {
const store = path.join(__dirname, 'partials/store');
const serverName = 'verdaccio-test';
const version = '1.0.0';
const address = 'https://www.domain.com:443';
const realProcess = process;
// @ts-ignore
jest.spyOn(process, 'exit').mockImplementation(() => {});
const conf = config();
conf.https = {};
// save process to catch exist
const exitMock = jest.fn();
// @ts-ignore
global.process = { ...realProcess, exit: exitMock };
await startServer(conf, address, store, version, serverName, () => {
startServer(conf, address, store, version, serverName, () => {
expect(logger.fatal).toHaveBeenCalled();
expect(logger.fatal).toHaveBeenCalledTimes(2);
done();
});
expect(exitMock).toHaveBeenCalledWith(2);
// restore process
global.process = realProcess;
});
test('should start a https server with key and cert', async (done) => {
@ -180,7 +147,7 @@ describe('startServer via API', () => {
const conf = config();
conf.https = {
key: keyPath,
cert: certPath
cert: certPath,
};
await startServer(conf, address, store, version, serverName, (webServer, addrs) => {