diff --git a/package-lock.json b/package-lock.json index 84a69aa0..e4e09791 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,6 +51,7 @@ "@cityssm/fa-glow": "^0.1.0", "@cityssm/mssql-multi-pool": "^4.0.0", "@cityssm/simple-fa5-checkbox": "^0.2.1", + "@cityssm/to-millis": "^0.1.0", "@types/activedirectory2": "^1.2.6", "@types/better-sqlite3": "^7.6.11", "@types/compression": "^1.7.5", @@ -2546,6 +2547,13 @@ "integrity": "sha512-0/jrhjpjbazae/qvEa2WmzzmAtQ0lLHb7NrNcPvqfxrbbFhKuGRkF/4LvhofiXL/oS+n8Tex/tu97cylvj/UMA==", "dev": true }, + "node_modules/@cityssm/to-millis": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@cityssm/to-millis/-/to-millis-0.1.0.tgz", + "integrity": "sha512-FvS+AUk1tp46grZnIEdIFRhOhbX7Cu8J70a2H1mW21RRmiXIcYPlumpOU4HPsM/pAL79csMwacEVzzotjJ3wgQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@cityssm/utils-datetime": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@cityssm/utils-datetime/-/utils-datetime-1.3.0.tgz", diff --git a/package.json b/package.json index 84d96219..515e2e22 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@cityssm/fa-glow": "^0.1.0", "@cityssm/mssql-multi-pool": "^4.0.0", "@cityssm/simple-fa5-checkbox": "^0.2.1", + "@cityssm/to-millis": "^0.1.0", "@types/activedirectory2": "^1.2.6", "@types/better-sqlite3": "^7.6.11", "@types/compression": "^1.7.5", diff --git a/test/1_serverCypress.js b/test/1_serverCypress.js index 917d8fa4..be8bc7e3 100644 --- a/test/1_serverCypress.js +++ b/test/1_serverCypress.js @@ -2,6 +2,7 @@ import assert from 'node:assert'; import { exec } from 'node:child_process'; import http from 'node:http'; +import { minutesToMillis } from '@cityssm/to-millis'; import { app } from '../app.js'; import { portNumber } from './_globals.js'; function runCypress(browser, done) { @@ -9,6 +10,7 @@ function runCypress(browser, done) { if ((process.env.CYPRESS_RECORD_KEY ?? '') !== '') { cypressCommand += ` --tag "${browser},${process.version}" --record`; } + // eslint-disable-next-line security/detect-child-process, sonarjs/os-command const childProcess = exec(cypressCommand); childProcess.stdout?.on('data', (data) => { console.log(data); @@ -44,9 +46,9 @@ describe('lot-occupancy-system', () => { describe('Cypress tests', () => { it('Should run Cypress tests in Chrome', (done) => { runCypress('chrome', done); - }).timeout(30 * 60 * 60 * 1000); + }).timeout(minutesToMillis(30)); it('Should run Cypress tests in Firefox', (done) => { runCypress('firefox', done); - }).timeout(30 * 60 * 60 * 1000); + }).timeout(minutesToMillis(30)); }); }); diff --git a/test/1_serverCypress.ts b/test/1_serverCypress.ts index b8cb2dbf..09c8f3e8 100644 --- a/test/1_serverCypress.ts +++ b/test/1_serverCypress.ts @@ -4,6 +4,8 @@ import assert from 'node:assert' import { exec } from 'node:child_process' import http from 'node:http' +import { minutesToMillis } from '@cityssm/to-millis' + import { app } from '../app.js' import { portNumber } from './_globals.js' @@ -15,6 +17,7 @@ function runCypress(browser: 'chrome' | 'firefox', done: () => void): void { cypressCommand += ` --tag "${browser},${process.version}" --record` } + // eslint-disable-next-line security/detect-child-process, sonarjs/os-command const childProcess = exec(cypressCommand) childProcess.stdout?.on('data', (data) => { @@ -59,10 +62,10 @@ describe('lot-occupancy-system', () => { describe('Cypress tests', () => { it('Should run Cypress tests in Chrome', (done) => { runCypress('chrome', done) - }).timeout(30 * 60 * 60 * 1000) + }).timeout(minutesToMillis(30)) it('Should run Cypress tests in Firefox', (done) => { runCypress('firefox', done) - }).timeout(30 * 60 * 60 * 1000) + }).timeout(minutesToMillis(30)) }) })