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:
parent
c724ccd331
commit
4f3afa33a2
6 changed files with 67 additions and 100 deletions
|
@ -59,7 +59,7 @@
|
||||||
"camelcase": "off",
|
"camelcase": "off",
|
||||||
"guard-for-in": "error",
|
"guard-for-in": "error",
|
||||||
"new-cap": "error",
|
"new-cap": "error",
|
||||||
"max-len": ["error", 160],
|
"max-len": ["error", 180],
|
||||||
"no-console": ["error", { "allow": ["warn"] }],
|
"no-console": ["error", { "allow": ["warn"] }],
|
||||||
"no-constant-condition": "error",
|
"no-constant-condition": "error",
|
||||||
"no-debugger": "error",
|
"no-debugger": "error",
|
||||||
|
|
2
.github/workflows/ci-e2e-ui.yml
vendored
2
.github/workflows/ci-e2e-ui.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Use Node ${{ matrix.node_version }}
|
- name: Use Node ${{ matrix.node_version }}
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node_version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
2
.github/workflows/ci-e2e.yml
vendored
2
.github/workflows/ci-e2e.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Use Node ${{ matrix.node_version }}
|
- name: Use Node ${{ matrix.node_version }}
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node_version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Use Node ${{ matrix.node_version }}
|
- name: Use Node ${{ matrix.node_version }}
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node_version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
- name: Use Node (latest)
|
- name: Use Node (latest)
|
||||||
uses: actions/setup-node@v2.1.5
|
uses: actions/setup-node@v2.1.5
|
||||||
with:
|
with:
|
||||||
node_version: 14
|
node-version: 14
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn install
|
run: yarn install
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
|
@ -19,8 +19,8 @@ jest.mock('../../../../src/lib/logger', () => ({
|
||||||
trace: jest.fn(),
|
trace: jest.fn(),
|
||||||
warn: jest.fn(),
|
warn: jest.fn(),
|
||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
fatal: jest.fn()
|
fatal: jest.fn(),
|
||||||
}
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('startServer via API', () => {
|
describe('startServer via API', () => {
|
||||||
|
@ -35,25 +35,18 @@ describe('startServer via API', () => {
|
||||||
const version = '1.0.0';
|
const version = '1.0.0';
|
||||||
const port = '6000';
|
const port = '6000';
|
||||||
|
|
||||||
await startServer(
|
await startServer(config(), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
|
||||||
config(),
|
expect(webServer).toBeDefined();
|
||||||
port,
|
expect(addrs).toBeDefined();
|
||||||
store,
|
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
||||||
version,
|
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
||||||
serverName,
|
expect(addrs.port).toBe(port);
|
||||||
(webServer, addrs, pkgName, pkgVersion) => {
|
expect(pkgName).toBeDefined();
|
||||||
expect(webServer).toBeDefined();
|
expect(pkgVersion).toBeDefined();
|
||||||
expect(addrs).toBeDefined();
|
expect(pkgVersion).toBe(version);
|
||||||
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
expect(pkgName).toBe(serverName);
|
||||||
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
done();
|
||||||
expect(addrs.port).toBe(port);
|
});
|
||||||
expect(pkgName).toBeDefined();
|
|
||||||
expect(pkgVersion).toBeDefined();
|
|
||||||
expect(pkgVersion).toBe(version);
|
|
||||||
expect(pkgName).toBe(serverName);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should set keepAliveTimeout to 0 seconds', async (done) => {
|
test('should set keepAliveTimeout to 0 seconds', async (done) => {
|
||||||
|
@ -62,27 +55,20 @@ describe('startServer via API', () => {
|
||||||
const version = '1.0.0';
|
const version = '1.0.0';
|
||||||
const port = '6100';
|
const port = '6100';
|
||||||
|
|
||||||
await startServer(
|
await startServer(config(parseConfigurationFile('server/keepalivetimeout-0')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
|
||||||
config(parseConfigurationFile('server/keepalivetimeout-0')),
|
expect(webServer).toBeDefined();
|
||||||
port,
|
expect(webServer.keepAliveTimeout).toBeDefined();
|
||||||
store,
|
expect(webServer.keepAliveTimeout).toBe(0);
|
||||||
version,
|
expect(addrs).toBeDefined();
|
||||||
serverName,
|
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
||||||
(webServer, addrs, pkgName, pkgVersion) => {
|
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
||||||
expect(webServer).toBeDefined();
|
expect(addrs.port).toBe(port);
|
||||||
expect(webServer.keepAliveTimeout).toBeDefined();
|
expect(pkgName).toBeDefined();
|
||||||
expect(webServer.keepAliveTimeout).toBe(0);
|
expect(pkgVersion).toBeDefined();
|
||||||
expect(addrs).toBeDefined();
|
expect(pkgVersion).toBe(version);
|
||||||
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
expect(pkgName).toBe(serverName);
|
||||||
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
done();
|
||||||
expect(addrs.port).toBe(port);
|
});
|
||||||
expect(pkgName).toBeDefined();
|
|
||||||
expect(pkgVersion).toBeDefined();
|
|
||||||
expect(pkgVersion).toBe(version);
|
|
||||||
expect(pkgName).toBe(serverName);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should set keepAliveTimeout to 60 seconds', async (done) => {
|
test('should set keepAliveTimeout to 60 seconds', async (done) => {
|
||||||
|
@ -91,27 +77,20 @@ describe('startServer via API', () => {
|
||||||
const version = '1.0.0';
|
const version = '1.0.0';
|
||||||
const port = '6200';
|
const port = '6200';
|
||||||
|
|
||||||
await startServer(
|
await startServer(config(parseConfigurationFile('server/keepalivetimeout-60')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
|
||||||
config(parseConfigurationFile('server/keepalivetimeout-60')),
|
expect(webServer).toBeDefined();
|
||||||
port,
|
expect(webServer.keepAliveTimeout).toBeDefined();
|
||||||
store,
|
expect(webServer.keepAliveTimeout).toBe(60000);
|
||||||
version,
|
expect(addrs).toBeDefined();
|
||||||
serverName,
|
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
||||||
(webServer, addrs, pkgName, pkgVersion) => {
|
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
||||||
expect(webServer).toBeDefined();
|
expect(addrs.port).toBe(port);
|
||||||
expect(webServer.keepAliveTimeout).toBeDefined();
|
expect(pkgName).toBeDefined();
|
||||||
expect(webServer.keepAliveTimeout).toBe(60000);
|
expect(pkgVersion).toBeDefined();
|
||||||
expect(addrs).toBeDefined();
|
expect(pkgVersion).toBe(version);
|
||||||
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
expect(pkgName).toBe(serverName);
|
||||||
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
done();
|
||||||
expect(addrs.port).toBe(port);
|
});
|
||||||
expect(pkgName).toBeDefined();
|
|
||||||
expect(pkgVersion).toBeDefined();
|
|
||||||
expect(pkgVersion).toBe(version);
|
|
||||||
expect(pkgName).toBe(serverName);
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should set keepAliveTimeout to 5 seconds per default', async (done) => {
|
test('should set keepAliveTimeout to 5 seconds per default', async (done) => {
|
||||||
|
@ -120,50 +99,38 @@ describe('startServer via API', () => {
|
||||||
const version = '1.0.0';
|
const version = '1.0.0';
|
||||||
const port = '6300';
|
const port = '6300';
|
||||||
|
|
||||||
await startServer(
|
await startServer(config(parseConfigurationFile('server/keepalivetimeout-undefined')), port, store, version, serverName, (webServer, addrs, pkgName, pkgVersion) => {
|
||||||
config(parseConfigurationFile('server/keepalivetimeout-undefined')),
|
expect(webServer).toBeDefined();
|
||||||
port,
|
expect(webServer.keepAliveTimeout).toBeDefined();
|
||||||
store,
|
expect(webServer.keepAliveTimeout).toBe(5000);
|
||||||
version,
|
expect(addrs).toBeDefined();
|
||||||
serverName,
|
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
||||||
(webServer, addrs, pkgName, pkgVersion) => {
|
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
||||||
expect(webServer).toBeDefined();
|
expect(addrs.port).toBe(port);
|
||||||
expect(webServer.keepAliveTimeout).toBeDefined();
|
expect(pkgName).toBeDefined();
|
||||||
expect(webServer.keepAliveTimeout).toBe(5000);
|
expect(pkgVersion).toBeDefined();
|
||||||
expect(addrs).toBeDefined();
|
expect(pkgVersion).toBe(version);
|
||||||
expect(addrs.proto).toBe(DEFAULT_PROTOCOL);
|
expect(pkgName).toBe(serverName);
|
||||||
expect(addrs.host).toBe(DEFAULT_DOMAIN);
|
done();
|
||||||
expect(addrs.port).toBe(port);
|
});
|
||||||
expect(pkgName).toBeDefined();
|
|
||||||
expect(pkgVersion).toBeDefined();
|
|
||||||
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 store = path.join(__dirname, 'partials/store');
|
||||||
const serverName = 'verdaccio-test';
|
const serverName = 'verdaccio-test';
|
||||||
const version = '1.0.0';
|
const version = '1.0.0';
|
||||||
const address = 'https://www.domain.com:443';
|
const address = 'https://www.domain.com:443';
|
||||||
const realProcess = process;
|
// @ts-ignore
|
||||||
|
jest.spyOn(process, 'exit').mockImplementation(() => {});
|
||||||
|
|
||||||
const conf = config();
|
const conf = config();
|
||||||
conf.https = {};
|
conf.https = {};
|
||||||
// save process to catch exist
|
// save process to catch exist
|
||||||
const exitMock = jest.fn();
|
|
||||||
// @ts-ignore
|
startServer(conf, address, store, version, serverName, () => {
|
||||||
global.process = { ...realProcess, exit: exitMock };
|
|
||||||
await startServer(conf, address, store, version, serverName, () => {
|
|
||||||
expect(logger.fatal).toHaveBeenCalled();
|
expect(logger.fatal).toHaveBeenCalled();
|
||||||
expect(logger.fatal).toHaveBeenCalledTimes(2);
|
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) => {
|
test('should start a https server with key and cert', async (done) => {
|
||||||
|
@ -180,7 +147,7 @@ describe('startServer via API', () => {
|
||||||
const conf = config();
|
const conf = config();
|
||||||
conf.https = {
|
conf.https = {
|
||||||
key: keyPath,
|
key: keyPath,
|
||||||
cert: certPath
|
cert: certPath,
|
||||||
};
|
};
|
||||||
|
|
||||||
await startServer(conf, address, store, version, serverName, (webServer, addrs) => {
|
await startServer(conf, address, store, version, serverName, (webServer, addrs) => {
|
||||||
|
|
Loading…
Reference in a new issue