Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Node 20 #19884

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -417,7 +417,7 @@ jobs:
if: needs.job_get_metadata.outputs.changed_any_code == 'true'
strategy:
matrix:
node: [ '18.12.1' ]
node: [ '18.12.1', '20.11.1' ]
name: Unit tests (Node ${{ matrix.node }})
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -455,7 +455,7 @@ jobs:
if: needs.job_get_metadata.outputs.changed_core == 'true'
strategy:
matrix:
node: [ '18.12.1' ]
node: [ '18.12.1', '20.11.1' ]
env:
- DB: mysql8
NODE_ENV: testing-mysql
Expand Down
2 changes: 1 addition & 1 deletion ghost/admin/package.json
Expand Up @@ -26,7 +26,7 @@
"lint": "yarn lint:js && yarn lint:hbs"
},
"engines": {
"node": "^18.12.1"
"node": "^18.12.1 || ^20.11.1"
},
"devDependencies": {
"@babel/eslint-parser": "7.23.3",
Expand Down
4 changes: 2 additions & 2 deletions ghost/core/package.json
Expand Up @@ -53,8 +53,8 @@
"prepack": "node monobundle.js"
},
"engines": {
"node": "^18.12.1",
"cli": "^1.25.0"
"node": "^18.12.1 || ^20.11.1",
"cli": "^1.26.0"
},
"dependencies": {
"@extractus/oembed-extractor": "3.2.1",
Expand Down
18 changes: 16 additions & 2 deletions ghost/core/test/unit/server/services/custom-redirects/api.test.js
Expand Up @@ -95,15 +95,29 @@ describe('UNIT: redirects CustomRedirectsAPI class', function () {

describe('setFromFilePath', function () {
it('throws a syntax error when setting invalid JSON redirects file', async function () {
const invalidJSON = '{invalid json';
const invalidFilePath = path.join(__dirname, '/invalid/redirects/path.json');
fs.readFile.withArgs(invalidFilePath, 'utf-8').resolves('{invalid json');
fs.readFile.withArgs(invalidFilePath, 'utf-8').resolves(invalidJSON);

let expectedErrorMessage;

try {
JSON.parse(invalidJSON);
} catch (err) {
expectedErrorMessage = err.message;
}

if (!expectedErrorMessage) {
// This should never happen because the JSON is invalid
should.fail('expectedErrorMessage is not set');
}

try {
await customRedirectsAPI.setFromFilePath(invalidFilePath, '.json');
should.fail('setFromFilePath did not throw');
} catch (err) {
should.exist(err);
err.message.should.eql('Could not parse JSON: Unexpected token i in JSON at position 1.');
err.message.should.eql(`Could not parse JSON: ${expectedErrorMessage}.`);
}
});

Expand Down